Skip to content

Commit 03d9e12

Browse files
author
invincibleqc
committed
Fixed EngineSound.emit_sound from crashing on OrangeBox engine.
1 parent d09384f commit 03d9e12

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core/modules/engines/orangebox/engines_wrap_python.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ inline void IEngineSound_EmitSound(IEngineSound* pEngineSound, IRecipientFilter&
7171
float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM, const Vector *pOrigin = NULL, const Vector *pDirection = NULL,
7272
tuple origins = tuple(), bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1)
7373
{
74-
CUtlVector< Vector > pUtlVecOrigins;
75-
for(int i=0; i < len(origins); i++)
74+
CUtlVector< Vector > *pUtlVecOrigins = NULL;
75+
if (len(origins) > 0)
7676
{
77-
pUtlVecOrigins.AddToTail(extract<Vector>(origins[i]));
77+
for(int i=0; i < len(origins); i++)
78+
{
79+
pUtlVecOrigins->AddToTail(extract<Vector>(origins[i]));
80+
}
7881
}
7982

80-
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin, pDirection, &pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
83+
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
8184
}
8285

8386
// Visitor function

0 commit comments

Comments
 (0)