Minimal: Fix HP change crash (#7344)
authorSmallJoker <mk939@ymail.com>
Wed, 16 May 2018 17:36:30 +0000 (19:36 +0200)
committerSmallJoker <mk939@ymail.com>
Wed, 16 May 2018 17:44:21 +0000 (19:44 +0200)
games/minimal/mods/test/init.lua

index 3141b4cf329d329b23d80fc8ad33148e2b9afd66..4806ba4fca0cb88a91bf0a05cd4d7b653d1d12d3 100644 (file)
@@ -27,6 +27,10 @@ local function run_hpchangereason_tests(player)
        assert(expect == nil)
 end
 minetest.register_on_player_hpchange(function(player, hp, reason)
+       if not expect then
+               return
+       end
+
        for key, value in pairs(reason) do
                assert(expect[key] == value)
        end