aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-01 23:03:11 +0100
committerKim Alvefur <zash@zash.se>2021-12-01 23:03:11 +0100
commit7182a72911b677f951facf49ebe01c8ab4fa7376 (patch)
treecdb7e0672f9a77c83c858ec806193b654d625600 /plugins
parenta7783d452a83eb5a67c380ccb12989111827a3c6 (diff)
downloadprosody-7182a72911b677f951facf49ebe01c8ab4fa7376.tar.gz
prosody-7182a72911b677f951facf49ebe01c8ab4fa7376.zip
mod_smacks: Fix empty cache check
In Lua, every value except `nil` and `false` are considered true in boolean expressions, even `0` as here, which means this was dead code.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_smacks.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua
index f6fecdb2..53ef87b3 100644
--- a/plugins/mod_smacks.lua
+++ b/plugins/mod_smacks.lua
@@ -70,7 +70,7 @@ local function init_session_cache(max_entries, evict_callback)
if not stores[user] then stores[user] = cache.new(max_entries, evict_callback); end
stores[user]:set(key, value);
-- remove empty caches completely
- if not stores[user]:count() then stores[user] = nil; end
+ if stores[user]:count() == 0 then stores[user] = nil; end
end;
};
end