]> git.lizzy.rs Git - minetest.git/commitdiff
DevTest: Reject buggy "/hp inf" command (#12830)
authorWuzzy <Wuzzy@disroot.org>
Mon, 3 Oct 2022 16:13:23 +0000 (18:13 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Oct 2022 16:13:23 +0000 (12:13 -0400)
games/devtest/mods/util_commands/init.lua

index c37364042f8cc7b2607cfb12e4c55f3379ac7f27..4f80172c6f2903540d28208d1caa18f0c089d959 100644 (file)
@@ -28,7 +28,7 @@ minetest.register_chatcommand("hp", {
                        return false, "No player."
                end
                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!"
                end
                player:set_hp(hp)