]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Do not fail on empty limits 5232/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 25 Nov 2024 11:10:17 +0000 (11:10 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 25 Nov 2024 11:10:17 +0000 (11:10 +0000)
lualib/rspamadm/fuzzy_stat.lua

index c65a1a477b7bff6ef31c8e52b84260919157bbad..c5b6ec38445fbdc3e64f9a06bcaf10501092f071 100644 (file)
@@ -64,7 +64,12 @@ local function add_data(target, src)
         end
         if type(v.extensions.ratelimit) == 'table' then
           if not target.ratelimit then
-            target.ratelimit = {}
+            target.ratelimit = {
+              cur = {
+                last = 0,
+                count = 0
+              },
+            }
           end
           -- Passed as {burst = x, rate = y}
           target.ratelimit.limit = v.extensions.ratelimit
@@ -76,7 +81,7 @@ local function add_data(target, src)
           cur = {
             last = 0,
             count = 0
-          }
+          },
         }
       end
       -- Ratelimit is passed as {cur = count, last = time}