From: Sipwise Development Team <support@sipwise.com>
Date: Wed, 12 May 2021 11:53:43 +0200
Subject: db_redis_skip_empty_keys

---
 src/modules/db_redis/redis_dbase.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 254e0f6..aa0a9fd 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -641,6 +641,9 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
         LM_DBG("no direct entry key found, checking type keys\n");
         for (type = table->types; type; type = type->next) {
             key = type->keys;
+	    /* skip value-less master keys */
+            if (!key)
+                continue;
             LM_DBG("checking type '%.*s'\n", type->type.len, type->type.s);
             if (db_redis_find_query_key(key, table_name, table, &type->type, _k, _v, _op, _n, &keyname,
                         &key_found, ts_scan_start) != 0) {
