Diff

plugins/mod_admin_shell.lua @ 12505:604bb5b8362d 0.12

mod_admin_shell: Tighten up type checks to fix #1754 (thanks clouded) Due to the dummy statistics provider (see core.statsmanager line 250) having a metatable that allows infinite indexing where everything is always the same table, which end up in suf() in the concatenation line.
author Kim Alvefur <zash@zash.se>
date Sun, 15 May 2022 23:16:14 +0200
parent 12304:8210c2a52e9c
child 12506:d04f6f014636
child 12637:2200f0c6b3f1
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Mon May 09 22:39:05 2022 +0200
+++ b/plugins/mod_admin_shell.lua	Sun May 15 23:16:14 2022 +0200
@@ -49,12 +49,12 @@
 end
 
 local function pre(prefix, str, alt)
-	if (str or "") == "" then return alt or ""; end
+	if type(str) ~= "string" or str == "" then return alt or ""; end
 	return prefix .. str;
 end
 
 local function suf(str, suffix, alt)
-	if (str or "") == "" then return alt or ""; end
+	if type(str) ~= "string" or str == "" then return alt or ""; end
 	return str .. suffix;
 end