From ef30ea1b5d47507fdaeb52f20cdfa51d306645cf Mon Sep 17 00:00:00 2001 From: staphen Date: Thu, 23 Nov 2023 23:19:59 -0500 Subject: [PATCH] Don't access sgSFX if sound is not initialized --- Source/effects.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/effects.cpp b/Source/effects.cpp index 4962c0281..1683947b4 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -182,6 +182,8 @@ void PrivSoundInit(uint8_t bLoadMask) bool effect_is_playing(SfxID nSFX) { + if (!gbSndInited) return false; + TSFX *sfx = &sgSFX[static_cast(nSFX)]; if (sfx->pSnd != nullptr) return sfx->pSnd->isPlaying(); @@ -204,6 +206,8 @@ void PlaySFX(SfxID psfx) { psfx = RndSFX(psfx); + if (!gbSndInited) return; + PlaySfxPriv(&sgSFX[static_cast(psfx)], false, { 0, 0 }); }