aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-02-11 13:23:03 +0100
committersfan5 <sfan5@live.de>2020-02-11 19:21:12 +0100
commit91eef646a59575bd9ae792e257bb6ad12fafc0b1 (patch)
treef7346e6020225e143b8da6c25d3ffe0572674f4c /src/script/lua_api/l_object.cpp
parentb14aa1c84714a4800d214768ff7868a7bb76f7ae (diff)
downloadhax-minetest-server-91eef646a59575bd9ae792e257bb6ad12fafc0b1.tar.gz
hax-minetest-server-91eef646a59575bd9ae792e257bb6ad12fafc0b1.zip
Script API: Check that SAOs are still usable before attempting to use them
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp4
1 files changed, 4 insertions, 0 deletions
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;
}