Fix bug where restarting the song would sometimes crash.

This commit is contained in:
EliteMasterEric 2024-04-06 21:42:18 -04:00
parent 90f53a78c1
commit 5beb20ec7c

View file

@ -834,9 +834,12 @@ class PlayState extends MusicBeatSubState
inputSpitter = []; inputSpitter = [];
// Reset music properly. // Reset music properly.
FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; if (FlxG.sound.music != null)
FlxG.sound.music.pitch = playbackRate; {
FlxG.sound.music.pause(); FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset;
FlxG.sound.music.pitch = playbackRate;
FlxG.sound.music.pause();
}
if (!overrideMusic) if (!overrideMusic)
{ {
@ -852,7 +855,7 @@ class PlayState extends MusicBeatSubState
vocals.pause(); vocals.pause();
vocals.time = 0; vocals.time = 0;
FlxG.sound.music.volume = 1; if (FlxG.sound.music != null) FlxG.sound.music.volume = 1;
vocals.volume = 1; vocals.volume = 1;
vocals.playerVolume = 1; vocals.playerVolume = 1;
vocals.opponentVolume = 1; vocals.opponentVolume = 1;