Check for nil in cWorld:SpawnSplitExperienceOrbs binding (#4354)
Adds explicit nil check for 'position' parameter to prevent crashes if invalid. Fixes #4352
This commit is contained in:
parent
9dc1343bda
commit
c00b365617
@ -890,7 +890,7 @@ static int tolua_cWorld_SpawnSplitExperienceOrbs(lua_State* tolua_S)
|
||||
}
|
||||
|
||||
cWorld * self = nullptr;
|
||||
Vector3d * Position;
|
||||
Vector3d * Position = nullptr;
|
||||
int Reward;
|
||||
L.GetStackValues(1, self, Position, Reward);
|
||||
if (self == nullptr)
|
||||
@ -898,6 +898,11 @@ static int tolua_cWorld_SpawnSplitExperienceOrbs(lua_State* tolua_S)
|
||||
tolua_error(tolua_S, "Invalid 'self' in function 'SpawnSplitExperienceOrbs'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
if (Position == nullptr)
|
||||
{
|
||||
tolua_error(tolua_S, "Error in function 'SpawnSplitExperienceOrbs' arg #2. Value must not be nil.", nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute and push result:
|
||||
L.Push(self->SpawnExperienceOrb(Position->x, Position->y, Position->z, Reward));
|
||||
|
Loading…
Reference in New Issue
Block a user