]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Do not crash if no actions defined
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Dec 2017 18:26:17 +0000 (18:26 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Dec 2017 18:26:17 +0000 (18:26 +0000)
lualib/rspamd_config_transform.lua

index a46ede336ccb3ddf3d26b31f4003573e2161ebad..e74c0f689cd10f5afc921fd6c4ce300cffb4b414 100644 (file)
@@ -256,21 +256,21 @@ return function(cfg)
 
   if not cfg.actions then
     logger.errx('no actions defined')
-  end
-
-  -- Perform sanity check for actions
-  local actions_defs = {'greylist', 'add header', 'add_header',
-    'rewrite subject', 'rewrite_subject', 'reject'}
-
-  if not cfg.actions['no action'] and not cfg.actions['no_action'] and
-      not cfg.actions['accept'] then
-    for _,d in ipairs(actions_defs) do
-      if cfg.actions[d] then
-        if cfg.actions[d] < 0 then
-          cfg.actions['no action'] = cfg.actions[d] - 0.001
-          logger.infox('set no action score to: %s, as action %s has negative score',
+  else
+    -- Perform sanity check for actions
+    local actions_defs = {'greylist', 'add header', 'add_header',
+      'rewrite subject', 'rewrite_subject', 'reject'}
+
+    if not cfg.actions['no action'] and not cfg.actions['no_action'] and
+        not cfg.actions['accept'] then
+      for _,d in ipairs(actions_defs) do
+        if cfg.actions[d] then
+          if cfg.actions[d] < 0 then
+            cfg.actions['no action'] = cfg.actions[d] - 0.001
+            logger.infox('set no action score to: %s, as action %s has negative score',
               cfg.actions['no action'], d)
-          break
+            break
+          end
         end
       end
     end