diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-03 18:48:58 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-03 18:48:58 +0000 |
commit | 216ce8c991729625779732c77c5467d062fa36d6 (patch) | |
tree | ce5e720ce51672155f97a3c91813de77cc81f56a | |
parent | a03ca6ec78fd137bdfc6a9ea2fdcf53d92458d8c (diff) | |
download | rspamd-216ce8c991729625779732c77c5467d062fa36d6.tar.gz rspamd-216ce8c991729625779732c77c5467d062fa36d6.zip |
[Minor] Avoid NaN values
-rw-r--r-- | lualib/meta_functions.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lualib/meta_functions.lua b/lualib/meta_functions.lua index 1394204c1..1c6d2cc2b 100644 --- a/lualib/meta_functions.lua +++ b/lualib/meta_functions.lua @@ -255,8 +255,14 @@ local function meta_words_function(task) short_words, ret_len, } + + local divisor = 1.0 + if #tp > 0 then + divisor = tp + end + for _,wr in ipairs(wres) do - table.insert(ret, wr / #tp) + table.insert(ret, wr / divisor) end return ret |