mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
FATAL_ERROR
for orphan object refs in objectrefGetOrCreate
This commit is contained in:
parent
c0d10b24a4
commit
1c5776d13a
1 changed files with 3 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include "cpp_api/s_base.h"
|
#include "cpp_api/s_base.h"
|
||||||
#include "cpp_api/s_internal.h"
|
#include "cpp_api/s_internal.h"
|
||||||
#include "cpp_api/s_security.h"
|
#include "cpp_api/s_security.h"
|
||||||
|
#include "debug.h"
|
||||||
#include "lua_api/l_object.h"
|
#include "lua_api/l_object.h"
|
||||||
#include "common/c_converter.h"
|
#include "common/c_converter.h"
|
||||||
#include "server/player_sao.h"
|
#include "server/player_sao.h"
|
||||||
|
@ -467,12 +468,8 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj)
|
||||||
if (!cobj) {
|
if (!cobj) {
|
||||||
ObjectRef::create(L, nullptr); // dummy reference
|
ObjectRef::create(L, nullptr); // dummy reference
|
||||||
} else if (cobj->getId() == 0) {
|
} else if (cobj->getId() == 0) {
|
||||||
// TODO after 5.10.0: convert this to a FATAL_ERROR
|
FATAL_ERROR("ScriptApiBase::objectrefGetOrCreate(): "
|
||||||
errorstream << "ScriptApiBase::objectrefGetOrCreate(): "
|
"Pushing orphan ObjectRef. Please open a bug report for this.");
|
||||||
<< "Pushing orphan ObjectRef. Please open a bug report for this."
|
|
||||||
<< std::endl;
|
|
||||||
assert(0);
|
|
||||||
ObjectRef::create(L, cobj);
|
|
||||||
} else {
|
} else {
|
||||||
push_objectRef(L, cobj->getId());
|
push_objectRef(L, cobj->getId());
|
||||||
if (cobj->isGone())
|
if (cobj->isGone())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue