- added missing validation to S_GetUserFlags functions.

This commit is contained in:
Christoph Oelckers 2020-01-12 09:32:30 +01:00
parent b57d683938
commit 9ca2819ad1
2 changed files with 2 additions and 0 deletions

View file

@ -114,6 +114,7 @@ float S_ConvertPitch(int lpitch)
int S_GetUserFlags(int num) int S_GetUserFlags(int num)
{ {
if (!soundEngine->isValidSoundId(num+1)) return 0;
auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1); auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1);
if (!snd) return 0; if (!snd) return 0;
return snd->flags; return snd->flags;

View file

@ -113,6 +113,7 @@ float S_ConvertPitch(int lpitch)
int S_GetUserFlags(int num) int S_GetUserFlags(int num)
{ {
if (!soundEngine->isValidSoundId(num+1)) return 0;
auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1); auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1);
if (!snd) return 0; if (!snd) return 0;
return snd->flags; return snd->flags;