Fix crash on malformed /tcsend.

This commit is contained in:
Aaron Suen 2020-03-14 11:38:50 -04:00
parent 9d33c618e2
commit 0b1e351911

View File

@ -280,7 +280,7 @@ minetest.register_chatcommand("tcsend", {
return minetest.chat_send_all("telecode shared by " return minetest.chat_send_all("telecode shared by "
.. pname .. ": " .. t) .. pname .. ": " .. t)
end end
else elseif dest then
local targ = minetest.get_player_by_name(dest) local targ = minetest.get_player_by_name(dest)
if not targ then return false, "player not found" end if not targ then return false, "player not found" end
send = function(t) send = function(t)
@ -288,10 +288,12 @@ minetest.register_chatcommand("tcsend", {
"telecode privately sent by " .. pname .. ": " .. t), "telecode privately sent by " .. pname .. ": " .. t),
"telecode sent" "telecode sent"
end end
else
return false, "share target not specified"
end end
local pos local pos
if name ~= "" then if name and name ~= "" then
pos = tcfind(player, name) pos = tcfind(player, name)
if not pos then return false, "location not found" end if not pos then return false, "location not found" end
else else