diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index 74393dfdd..cdd0361c5 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -388,7 +388,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source, FVector3 pos, vel; FRolloffInfo *rolloff; - if (sound_id <= 0 || volume <= 0 || nosfx || !SoundEnabled() || blockNewSounds) + if (sound_id <= 0 || volume <= 0 || nosfx || !SoundEnabled() || blockNewSounds || (unsigned)sound_id >= S_sfx.Size()) return NULL; // prevent crashes. diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index 7d37c9952..f508c187f 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -416,7 +416,7 @@ static int S_AddSound (const char *logicalname, int lumpnum, FScanner *sc) sfxid = soundEngine->FindSoundNoHash (logicalname); - if (sfxid > 0) + if ((unsigned int)sfxid < S_sfx.Size()) { // If the sound has already been defined, change the old definition sfxinfo_t *sfx = &S_sfx[sfxid];