summaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2016-12-04 10:24:14 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2016-12-04 10:24:14 +0300
commit3f395bf7ac1a80e5fca20e5e7a487b212551954b (patch)
tree5202beb247c2eca16a0a303c971141d9cb58a3f2 /rules
parent5fc30a05fbd7eb93e2318e642fee942e874f60fc (diff)
downloadrspamd-3f395bf7ac1a80e5fca20e5e7a487b212551954b.tar.gz
rspamd-3f395bf7ac1a80e5fca20e5e7a487b212551954b.zip
[Minor] Avoid nil index
Diffstat (limited to 'rules')
-rw-r--r--rules/misc.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index 5eeda6af3..dd2ead132 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -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