From daf1ba85dc199b9def60866b4bf0fe31ed96f03c Mon Sep 17 00:00:00 2001
From: Eric <ericmyllyoja@gmail.com>
Date: Mon, 20 Nov 2023 11:27:58 -0500
Subject: [PATCH] Fix crash on completing song after playtesting (#217)

Co-authored-by: Cameron Taylor <cameron.taylor.ninja@gmail.com>
---
 source/funkin/ui/debug/charting/ChartEditorState.hx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx
index ee8af9191..0349db550 100644
--- a/source/funkin/ui/debug/charting/ChartEditorState.hx
+++ b/source/funkin/ui/debug/charting/ChartEditorState.hx
@@ -4515,6 +4515,7 @@ class ChartEditorState extends HaxeUIState
   /**
    * Fix the current scroll position after exiting the PlayState used when testing.
    */
+  @:nullSafety(Off)
   function resetConductorAfterTest(_:FlxSubState = null):Void
   {
     moveSongToScrollPosition();
@@ -4526,7 +4527,11 @@ class ChartEditorState extends HaxeUIState
     var instTargetVolume:Float = instVolumeSlider?.value ?? 1.0;
     var vocalTargetVolume:Float = vocalVolumeSlider?.value ?? 1.0;
 
-    if (audioInstTrack != null) audioInstTrack.volume = instTargetVolume;
+    if (audioInstTrack != null)
+    {
+      audioInstTrack.volume = instTargetVolume;
+      audioInstTrack.onComplete = null;
+    }
     if (audioVocalTrackGroup != null) audioVocalTrackGroup.volume = vocalTargetVolume;
   }