Fix crash if audio init fails (especially if there are no output devices)

This commit is contained in:
elasota
2020-05-28 23:05:32 -04:00
parent 11628ddd93
commit 42e124a90c
2 changed files with 17 additions and 3 deletions

View File

@@ -134,7 +134,7 @@ void ToggleMusicWhilePlaying (void)
void SetMusicalMode (short newMode)
{
if (dontLoadMusic)
if (dontLoadMusic || failedMusic)
return;
musicMutex->Lock();
@@ -302,6 +302,12 @@ void InitMusic (void)
return;
}
theErr = OpenMusicChannel();
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowNoMusic, theErr);
failedMusic = true;
return;
}
musicScore[0] = 0;
musicScore[1] = 1;