Skip to content

Commit

Permalink
Fix Null object Reference (#337)
Browse files Browse the repository at this point in the history
* Fix Null object Reference

When you pause in a specific time in the countdown (when the countdown is finishing) it crashs.

I just added a null check for the song to fix it.

* Update PlayState.hx
  • Loading branch information
TheoDevelops authored Aug 26, 2024
1 parent abb8449 commit 6c34dbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ class PlayState extends MusicBeatState
if (Conductor.songPosition >= 0)
startSong();
}
} else {
} else if (FlxG.sound.music != null) {
var instTime = FlxG.sound.music.time;
var isOffsync = vocals.time != instTime || [for(strumLine in strumLines.members) strumLine.vocals.time != instTime].contains(true);
__vocalOffsetViolation = Math.max(0, __vocalOffsetViolation + (isOffsync ? elapsed : -elapsed / 2));
Expand Down

0 comments on commit 6c34dbf

Please sign in to comment.