pandorabox-io / pandorabox.io

Pandorabox infrastructure code
https://pandorabox.io
31 stars 4 forks source link

Crash due to channel invitation #269

Closed ghost closed 5 years ago

ghost commented 5 years ago

Issuing the command /invite_channel or /ic currently causes the server to crash

thomasrudin commented 5 years ago

Thx for reporting, i extracted this from the logs:

minetest_1           | 2019-08-11 13:26:20: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'beerchat' in callback on_chat_message(): /data/world//worldmods/beerchat/format_message.lua:11: attempt to index local 's' (a nil value)
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]: stack traceback:
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]:    /data/world//worldmods/beerchat/format_message.lua:11: in function 'colorize_target_name'
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]:    /data/world//worldmods/beerchat/format_message.lua:35: in function 'format_message'
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]:    /data/world//worldmods/beerchat/chatcommands.lua:286: in function 'func'
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]:    /usr/local/share/minetest/builtin/game/chatcommands.lua:30: in function </usr/local/share/minetest/builtin/game/chatcommands.lua:9>
minetest_1           | 2019-08-11 13:26:20: ERROR[Main]:    /usr/local/share/minetest/builtin/game/register.lua:419: in function </usr/local/share/minetest/builtin/game/register.lua:399>

I think that has to do with the name-coloring feature: https://github.com/pandorabox-io/beerchat/blob/master/format_message.lua

ghost commented 5 years ago

From what I've tested you simply can't call colorize_target_name() with server messages so messages in param(beerchat/format_message:29) should be set to nil when it's called from the chat commands, but I have several ways of doing this and I don't think they're efficient since I'm not familiar with lua.

1st. solution is to make another params variable(that doesn't call colorize_target_name()) for when it's called by a server message. 2nd. make another function that doesn't call colorize_target_name(). 3rd. some other stupid way.