Skip to content
Snippets Groups Projects

Duke3D: Check that the sound index is nonnegative in S_SoundIsValid.

Closed NY00123 requested to merge sound_crash_fix into master
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -77,7 +77,7 @@ extern int32_t MusicIsWaveform, MusicVoice;
static FORCE_INLINE bool S_SoundIsValid(int soundNum)
{
return soundNum <= g_highestSoundIdx && g_sounds[soundNum] && g_sounds[soundNum] != &nullsound && g_sounds[soundNum]->ptr;
return soundNum >= 0 && soundNum <= g_highestSoundIdx && g_sounds[soundNum] && g_sounds[soundNum] != &nullsound && g_sounds[soundNum]->ptr;
}
static FORCE_INLINE bool S_IsAmbientSFX(int const spriteNum) { return (sprite[spriteNum].picnum == MUSICANDSFX && sprite[spriteNum].lotag < 999); }
Loading