]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Oops, fix null check logic
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 31 Mar 2022 10:26:06 +0000 (11:26 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 31 Mar 2022 10:26:06 +0000 (11:26 +0100)
src/rspamd_proxy.c

index 937a6af895564e73d7c3ebe3c88dad7c4dbaaa97..aad1a49fd1acefb693e42b84be6ad02c77417bcc 100644 (file)
@@ -328,18 +328,18 @@ rspamd_proxy_parse_upstream (rspamd_mempool_t *pool,
        L = ctx->lua_state;
 
        if (ucl_object_type (obj) != UCL_OBJECT) {
+               if (ucl_object_type (obj) != UCL_NULL) {
+                       msg_info_pool_check("upstream %s is disabled by setting it to NULL",
+                                       ucl_object_key (obj));
+                       return TRUE;
+               }
+
                g_set_error (err, rspamd_proxy_quark (), 100,
                                "upstream option must be an object");
 
                return FALSE;
        }
 
-       if (ucl_object_type (obj) != UCL_NULL) {
-               msg_info_pool_check("upstream %s is disabled by setting it to NULL",
-                               ucl_object_key (obj));
-               return TRUE;
-       }
-
        if (!rspamd_config_is_enabled_from_ucl (pool, obj)) {
                /* Upstream is valid but disabled */
                msg_info_pool_check("upstream %s is disabled",
@@ -505,13 +505,13 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool,
        ctx = pd->user_struct;
        L = ctx->lua_state;
 
-       if (ucl_object_type (obj) != UCL_NULL) {
-               msg_info_pool_check("mirror %s is disabled by setting it to NULL",
-                               ucl_object_key (obj));
-               return TRUE;
-       }
-
        if (ucl_object_type (obj) != UCL_OBJECT) {
+               if (ucl_object_type (obj) != UCL_NULL) {
+                       msg_info_pool_check("mirror %s is disabled by setting it to NULL",
+                                       ucl_object_key (obj));
+                       return TRUE;
+               }
+
                g_set_error (err, rspamd_proxy_quark (), 100,
                                "mirror option must be an object");