]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Avoid nil index
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 4 Dec 2016 07:24:14 +0000 (10:24 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 4 Dec 2016 07:24:14 +0000 (10:24 +0300)
rules/misc.lua

index 5eeda6af3059b158b8bf0f776414411c58a072e6..dd2ead132331440b76c527164af4f0828815f640 100644 (file)
@@ -494,11 +494,11 @@ local check_from_id = rspamd_config:register_callback_symbol('CHECK_FROM', 1.0,
     end
 
     local to = task:get_recipients(2)
-    if not (to and to[1]) then return false end
+    if not (to and to[1] and #to == 1 and from) then return false end
     -- Check if FROM == TO
-    if (#to == 1 and to[1].addr:lower() == from[1].addr:lower()) then
+    if (to[1].addr:lower() == from[1].addr:lower()) then
       task:insert_result('TO_EQ_FROM', 1.0)
-    elseif (#to == 1 and to[1].domain and from[1].domain and
+    elseif (to[1].domain and from[1].domain and
         to[1].domain:lower() == from[1].domain:lower()) then
       task:insert_result('TO_DOM_EQ_FROM_DOM', 1.0)
     end