1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Script API: Check that SAOs are still usable before attempting to use them

This commit is contained in:
sfan5 2020-02-11 13:23:03 +01:00
parent b14aa1c847
commit 91eef646a5
3 changed files with 8 additions and 10 deletions

View file

@ -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;
}