Closed S-S-X closed 1 year ago
Checked a bit and I think root of the problem is in override: https://github.com/mt-mods/beerchat/blob/845ef5ea4fc4f841fbb574a8aa69d8fa07acff00/plugin/override.lua#L11-L14
Might be that using /tell <any recipient>
without adding message after recipient name will make it crash because pattern requires %s+
which causes target
to be nil
if there's no space after target even if target itself is specified.
While fixing root cause would be very good idea I think it might anyway also be good to add nil checks to is_muted
here:
https://github.com/mt-mods/beerchat/blob/845ef5ea4fc4f841fbb574a8aa69d8fa07acff00/plugin/mute.lua#L2-L10
For is_muted it is kind of "just in case" fix/check but I think it is appropriate in this case (in any case where input comes through common and public event handlers).
Typing just /tell
crashes the server
The following error occurs when typing just /tell
:
AsyncErr: Lua: Runtime error from mod 'mesecons_commandblock' in callback on_chat_message(): D:\minetest\bin\..\mods\beerchat/plugin/mute.lua:3: bad argument #1 to 'get_player_by_name' (string expected, got nil)
stack traceback:
[C]: in function 'get_player_by_name'
D:\minetest\bin\..\mods\beerchat/plugin/mute.lua:3: in function 'is_muted'
D:\minetest\bin\..\mods\beerchat/plugin/mute.lua:14: in function 'fn'
D:\minetest\bin\..\mods\beerchat/hooks.lua:65: in function 'execute_callbacks'
D:\minetest\bin\..\mods\beerchat/plugin/override.lua:12: in function 'func'
D:\minetest\bin\..\builtin\game\chat.lua:79: in function <D:\minetest\bin\..\builtin\game\chat.lua:52>
D:\minetest\bin\..\builtin\game\register.lua:446: in function <D:\minetest\bin\..\builtin\game\register.lua:432>
/tell
is located in mesecons_commandblock, not Beerchat
/tell
is located in mesecons_commandblock, not Beerchat
See linked PR #113 Its entry point is actually located on beerchat when beerchat is installed. Specifically in "plugin/override.lua" (code snippet on second comment here ^^).
And stack trace follows:
Might be
is_muted
or something around it should be changed a bit so that it is able to tolerate weird input.