From 03d9e12a35b065b64c3dc121237ce5a00c6edbb1 Mon Sep 17 00:00:00 2001 From: invincibleqc Date: Tue, 10 Jun 2014 20:58:55 -0400 Subject: [PATCH] Fixed EngineSound.emit_sound from crashing on OrangeBox engine. --- .../modules/engines/orangebox/engines_wrap_python.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/modules/engines/orangebox/engines_wrap_python.h b/src/core/modules/engines/orangebox/engines_wrap_python.h index dcbff9387..752f9803e 100644 --- a/src/core/modules/engines/orangebox/engines_wrap_python.h +++ b/src/core/modules/engines/orangebox/engines_wrap_python.h @@ -71,13 +71,16 @@ inline void IEngineSound_EmitSound(IEngineSound* pEngineSound, IRecipientFilter& float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM, const Vector *pOrigin = NULL, const Vector *pDirection = NULL, tuple origins = tuple(), bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) { - CUtlVector< Vector > pUtlVecOrigins; - for(int i=0; i < len(origins); i++) + CUtlVector< Vector > *pUtlVecOrigins = NULL; + if (len(origins) > 0) { - pUtlVecOrigins.AddToTail(extract(origins[i])); + for(int i=0; i < len(origins); i++) + { + pUtlVecOrigins->AddToTail(extract(origins[i])); + } } - pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin, pDirection, &pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity); + pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity); } // Visitor function