SCUMM: DiMUSE: Don't crash the app if we try to deallocate a non-existent soundfile

Previously we had asserts instructions in place for this; they work under the assumption that the user
always has the sound files available. Unfortunately this assumption breaks in at least two cases:
- The user plays the COMI demo (small version, without sound files);
- The user copies the whole COMI game from the CDs/Steam to the device of choice (e.g. tablet),
  and doesn't copy the BUN files over (e.g. for storage issues).

We simply remove the assertions and put a check in its place, and if that check fails we just exit
the function and resume normal execution. This fixes #13845.
This commit is contained in:
AndywinXp 2022-09-26 15:25:18 +02:00
parent f2f00d9774
commit c1502271b4

View File

@ -202,7 +202,9 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char
}
void ImuseDigiSndMgr::closeSound(SoundDesc *soundDesc) {
assert(checkForProperHandle(soundDesc));
// Check if there's an actual sound to close...
if (!checkForProperHandle(soundDesc))
return;
if (soundDesc->resPtr) {
bool found = false;
@ -242,7 +244,9 @@ void ImuseDigiSndMgr::scheduleSoundForDeallocation(int soundId) {
}
}
assert(checkForProperHandle(soundDesc));
// Check if there's an actual sound to deallocate...
if (!checkForProperHandle(soundDesc))
return;
soundDesc->scheduledForDealloc = true;
}