]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-sql: Treat NULL value the same as "key not found"
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 29 Jun 2016 16:22:51 +0000 (19:22 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 29 Jun 2016 16:24:23 +0000 (19:24 +0300)
src/lib-dict/dict-sql.c

index feb46a67c9a3ba96742643fedb87484571baaa6e..78df8e7dd11e5736d8c75bb08ad418225fab284d 100644 (file)
@@ -478,6 +478,12 @@ sql_dict_lookup_async_callback(struct sql_result *sql_result,
        else if (result.ret > 0) {
                result.value = sql_dict_result_unescape_value(ctx->map,
                        pool_datastack_create(), sql_result);
+               if (result.value == NULL) {
+                       /* NULL value returned. we'll treat this as
+                          "not found", which is probably what is usually
+                          wanted. */
+                       result.ret = 0;
+               }
        }
        ctx->callback(&result, ctx->context);