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:
parent
b14aa1c847
commit
91eef646a5
3 changed files with 8 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue