From 91eef646a59575bd9ae792e257bb6ad12fafc0b1 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 11 Feb 2020 13:23:03 +0100 Subject: Script API: Check that SAOs are still usable before attempting to use them --- src/script/lua_api/l_object.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index efdb345c9..f23282a95 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -60,6 +60,8 @@ LuaEntitySAO* ObjectRef::getluaobject(ObjectRef *ref) return NULL; if (obj->getType() != ACTIVEOBJECT_TYPE_LUAENTITY) return NULL; + if (obj->isGone()) + return NULL; return (LuaEntitySAO*)obj; } @@ -70,6 +72,8 @@ PlayerSAO* ObjectRef::getplayersao(ObjectRef *ref) return NULL; if (obj->getType() != ACTIVEOBJECT_TYPE_PLAYER) return NULL; + if (obj->isGone()) + return NULL; return (PlayerSAO*)obj; } -- cgit v1.2.3