commit 16ba8b5: [Minor] Oops, fix null check logic

Vsevolod Stakhov vsevolod at rspamd.com
Thu Mar 31 10:28:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-03-31 11:26:06 +0100
URL: https://github.com/rspamd/rspamd/commit/16ba8b55887ab1524ca8d9095f6a14726c91ed72 (HEAD -> master)

[Minor] Oops, fix null check logic

---
 src/rspamd_proxy.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 937a6af89..aad1a49fd 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -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");
 


More information about the Commits mailing list