Skip to content

Commit

Permalink
allow to set cbasentity return to nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurdead authored and peace-maker committed Mar 1, 2021
1 parent 574576c commit 1d7dcbe
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,16 @@ cell_t Native_SetReturn(IPluginContext *pContext, const cell_t *params)
break;
case ReturnType_CBaseEntity:
{
CBaseEntity *pEnt = gamehelpers->ReferenceToEntity(params[2]);
if(!pEnt)
{
return pContext->ThrowNativeError("Invalid entity index passed for return value");
if(params[2] == -1) {
returnStruct->newResult = nullptr;
} else {
CBaseEntity *pEnt = gamehelpers->ReferenceToEntity(params[2]);
if(!pEnt)
{
return pContext->ThrowNativeError("Invalid entity index passed for return value");
}
returnStruct->newResult = pEnt;
}
returnStruct->newResult = pEnt;
break;
}
case ReturnType_Edict:
Expand Down

0 comments on commit 1d7dcbe

Please sign in to comment.