From b2feac105ad3a2463916cf6cc907d848a7949d18 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 12 Jan 2023 17:38:51 -0400 Subject: [PATCH] Fix crash when using chat commands affect/removeaffects * related to pull request https://github.com/Bremaweb/adventuretest/pull/38 * related to pull request https://codeberg.org/minenux/minetest-game-adventuretest/pulls/38 * related to pull request https://git.minetest.io/minenux/minetest-game-adventuretest/pulls/38 --- mods/affects/chatcommands.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/affects/chatcommands.lua b/mods/affects/chatcommands.lua index 474ead1..41d937e 100644 --- a/mods/affects/chatcommands.lua +++ b/mods/affects/chatcommands.lua @@ -5,7 +5,9 @@ minetest.register_chatcommand("affect",{ privs = {affects=true}, func = function (name, param) local aname, affectid = string.match(param, "([^ ]+) (.+)") - if ( affects.affectPlayer(aname,affectid) ) then + if ( aname == nil or aname == "" or affectid == nil or affectid == '' ) then + minetest.chat_send_player(name, "Syntax: affect ") + elseif ( affects.affectPlayer(aname,affectid) ) then minetest.chat_send_player(name,aname.." has been affected by "..affects._affects[affectid].name) else minetest.chat_send_player(name,"Unable to affect "..aname.." with "..affectid)