mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 01:05:48 +01:00 
			
		
		
		
	FATAL_ERROR for orphan object refs in objectrefGetOrCreate
				
					
				
			This commit is contained in:
		
				
					committed by
					
						
						Lars Müller
					
				
			
			
				
	
			
			
			
						parent
						
							c0d10b24a4
						
					
				
				
					commit
					1c5776d13a
				
			@@ -5,6 +5,7 @@
 | 
			
		||||
#include "cpp_api/s_base.h"
 | 
			
		||||
#include "cpp_api/s_internal.h"
 | 
			
		||||
#include "cpp_api/s_security.h"
 | 
			
		||||
#include "debug.h"
 | 
			
		||||
#include "lua_api/l_object.h"
 | 
			
		||||
#include "common/c_converter.h"
 | 
			
		||||
#include "server/player_sao.h"
 | 
			
		||||
@@ -467,12 +468,8 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj)
 | 
			
		||||
	if (!cobj) {
 | 
			
		||||
		ObjectRef::create(L, nullptr); // dummy reference
 | 
			
		||||
	} else if (cobj->getId() == 0) {
 | 
			
		||||
		// TODO after 5.10.0: convert this to a FATAL_ERROR
 | 
			
		||||
		errorstream << "ScriptApiBase::objectrefGetOrCreate(): "
 | 
			
		||||
				<< "Pushing orphan ObjectRef. Please open a bug report for this."
 | 
			
		||||
				<< std::endl;
 | 
			
		||||
		assert(0);
 | 
			
		||||
		ObjectRef::create(L, cobj);
 | 
			
		||||
		FATAL_ERROR("ScriptApiBase::objectrefGetOrCreate(): "
 | 
			
		||||
				"Pushing orphan ObjectRef. Please open a bug report for this.");
 | 
			
		||||
	} else {
 | 
			
		||||
		push_objectRef(L, cobj->getId());
 | 
			
		||||
		if (cobj->isGone())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user