From 966841afbdae395cd4f4b76f91cbd9f334e0d58b Mon Sep 17 00:00:00 2001 From: Ross Bemrose Date: Thu, 3 Jul 2014 14:13:36 -0400 Subject: [PATCH] Make sure the edict isn't free. return GetParametersForSoundEx's return value instead of always true. --- extensions/sdktools/vsound.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/sdktools/vsound.cpp b/extensions/sdktools/vsound.cpp index c5bc921d..a015c385 100644 --- a/extensions/sdktools/vsound.cpp +++ b/extensions/sdktools/vsound.cpp @@ -533,7 +533,7 @@ bool GetSoundParams(CSoundParameters *soundParams, const char *soundname, cell_t if (ent > 0) { edict_t *edict = gamehelpers->EdictOfIndex(ent); - if (edict != NULL) + if (edict != NULL && !edict->IsFree()) { IServerEntity *serverEnt = edict->GetIServerEntity(); if (serverEnt != NULL) @@ -544,8 +544,7 @@ bool GetSoundParams(CSoundParameters *soundParams, const char *soundname, cell_t } } - soundemitterbase->GetParametersForSoundEx(soundname, index, *soundParams, gender); - return true; + return soundemitterbase->GetParametersForSoundEx(soundname, index, *soundParams, gender); } bool InternalPrecacheScriptSound(const char *soundname)