Fix custom procedural crash

This commit is contained in:
ALLEN-PC\acj30 2023-11-03 16:29:27 -05:00
parent 032cfdaec3
commit aa03b6b51e

View File

@ -736,6 +736,12 @@ CBaseEntity *CGlobalEntityList::FindEntityCustomProcedural( CBaseEntity *pStartE
g_pScriptVM->ExecuteFunction( g_CustomProcedurals[i].hFunc, args, 5, &functionReturn, NULL, true ); g_pScriptVM->ExecuteFunction( g_CustomProcedurals[i].hFunc, args, 5, &functionReturn, NULL, true );
if (pStartEntity && ToEnt( functionReturn.m_hScript ) == pStartEntity)
{
Warning( "WARNING: Custom procedural %s returned entity identical to start entity (%s), returning null\n", g_CustomProcedurals[i].szName, pStartEntity->GetDebugName() );
return NULL;
}
return ToEnt( functionReturn.m_hScript ); return ToEnt( functionReturn.m_hScript );
} }
} }