From f1a0692c51335f7d5ccf4236b3775f55fef7cd86 Mon Sep 17 00:00:00 2001
From: gamerbross <55158797+gamerbross@users.noreply.github.com>
Date: Wed, 15 May 2024 22:50:34 +0200
Subject: [PATCH] Fix ChartingState GameOver Crashes

---
 source/funkin/play/GameOverSubState.hx | 3 +++
 source/funkin/play/PlayState.hx        | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx
index c3abbcf3e..4d50d75cc 100644
--- a/source/funkin/play/GameOverSubState.hx
+++ b/source/funkin/play/GameOverSubState.hx
@@ -162,6 +162,8 @@ class GameOverSubState extends MusicBeatSubState
   @:nullSafety(Off)
   function setCameraTarget():Void
   {
+    if (PlayState.instance.isMinimalMode || boyfriend == null) return;
+
     // Assign a camera follow point to the boyfriend's position.
     cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1);
     cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x;
@@ -254,6 +256,7 @@ class GameOverSubState extends MusicBeatSubState
         this.close();
         if (FlxG.sound.music != null) FlxG.sound.music.pause(); // Don't reset song position!
         PlayState.instance.close(); // This only works because PlayState is a substate!
+        return;
       }
       else if (PlayStatePlaylist.isStoryMode)
       {
diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx
index a9ca09ce8..43dd485cf 100644
--- a/source/funkin/play/PlayState.hx
+++ b/source/funkin/play/PlayState.hx
@@ -1092,8 +1092,11 @@ class PlayState extends MusicBeatSubState
 
     healthBar.value = healthLerp;
 
-    iconP1.updatePosition();
-    iconP2.updatePosition();
+    if (!isMinimalMode)
+    {
+      iconP1.updatePosition();
+      iconP2.updatePosition();
+    }
 
     // Transition to the game over substate.
     var gameOverSubState = new GameOverSubState(