From 73b36a82bf3a8c6ff0082bd2248239a449ce28e2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 14 Jul 2016 17:45:05 +0100 Subject: [PATCH] [Fix] Do not die when no metrics defined --- src/libserver/cfg_utils.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index a38171475..709ce2adb 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1563,15 +1563,17 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, } } - /* Now we check symbols group */ - gr = g_hash_table_lookup (metric->groups, module_name); - - if (gr) { - if (gr->disabled) { - msg_info_config ("%s module %s is disabled in the configuration as " - "its group has been disabled", - is_c ? "internal" : "lua", module_name); - return FALSE; + if (metric) { + /* Now we check symbols group */ + gr = g_hash_table_lookup (metric->groups, module_name); + + if (gr) { + if (gr->disabled) { + msg_info_config ("%s module %s is disabled in the configuration as " + "its group has been disabled", + is_c ? "internal" : "lua", module_name); + return FALSE; + } } } -- 2.39.5