mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Script API: Check that SAOs are still usable before attempting to use them
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user