DevTest: Reject buggy "/hp inf" command (#12830)

This commit is contained in:
Wuzzy 2022-10-03 18:13:23 +02:00 committed by GitHub
parent 22cbc05808
commit b10d6542db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ minetest.register_chatcommand("hp", {
return false, "No player." return false, "No player."
end end
local hp = tonumber(param) local hp = tonumber(param)
if not hp then if not hp or minetest.is_nan(hp) or hp < 0 or hp > 65535 then
return false, "Missing or incorrect hp parameter!" return false, "Missing or incorrect hp parameter!"
end end
player:set_hp(hp) player:set_hp(hp)