diff --git a/server/src/player.hpp b/server/src/player.hpp index c21bf16f2..3929e1f86 100644 --- a/server/src/player.hpp +++ b/server/src/player.hpp @@ -472,12 +472,12 @@ class Player final: public BattleObject // if multiple results returned // we only check the first one, ignore all rest as lua does - if(const auto obj = (sol::object)(*(pfr.cbegin())); obj == sol::nil){ - return false; - } - else if(obj.is()){ + if(const auto obj = (sol::object)(*(pfr.cbegin())); obj.is()){ return obj.as(); } + else if(obj == sol::nil){ + return false; + } else{ throw fflerror("trigger returns invalid type(s): count = %d, [0]: %s", to_d(pfr.return_count()), to_cstr(sol::type_name(obj.lua_state(), obj.get_type()))); }