From 6c34dbf6207b9ef17f9d551b637f151aade4f4e3 Mon Sep 17 00:00:00 2001 From: TheoDev <132299142+TheoDevelops@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:12:35 -0700 Subject: [PATCH] Fix Null object Reference (#337) * 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 --- source/funkin/game/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index e97bee1a..8e6833b4 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -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));