Adding check if player is valid

This commit is contained in:
Niwla23 2019-05-11 22:21:31 +02:00
parent 8b9c5bf8cf
commit 3dbcebac0a

@ -13,6 +13,9 @@ minetest.register_chatcommand("seeinfo", {
description = "Sets your info", description = "Sets your info",
func = function(name, param) func = function(name, param)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if not player then
return false, "Player not found"
end
local player2getinfo = minetest.get_player_by_name(param) local player2getinfo = minetest.get_player_by_name(param)
minetest.chat_send_player(player:get_player_name(), player2getinfo:get_attribute("info")) minetest.chat_send_player(player:get_player_name(), player2getinfo:get_attribute("info"))
end, end,