Browse Source

Don't access sgSFX if sound is not initialized

pull/6832/head
staphen 2 years ago committed by Anders Jenbo
parent
commit
ef30ea1b5d
  1. 4
      Source/effects.cpp

4
Source/effects.cpp

@ -182,6 +182,8 @@ void PrivSoundInit(uint8_t bLoadMask)
bool effect_is_playing(SfxID nSFX) bool effect_is_playing(SfxID nSFX)
{ {
if (!gbSndInited) return false;
TSFX *sfx = &sgSFX[static_cast<int16_t>(nSFX)]; TSFX *sfx = &sgSFX[static_cast<int16_t>(nSFX)];
if (sfx->pSnd != nullptr) if (sfx->pSnd != nullptr)
return sfx->pSnd->isPlaying(); return sfx->pSnd->isPlaying();
@ -204,6 +206,8 @@ void PlaySFX(SfxID psfx)
{ {
psfx = RndSFX(psfx); psfx = RndSFX(psfx);
if (!gbSndInited) return;
PlaySfxPriv(&sgSFX[static_cast<int16_t>(psfx)], false, { 0, 0 }); PlaySfxPriv(&sgSFX[static_cast<int16_t>(psfx)], false, { 0, 0 });
} }

Loading…
Cancel
Save