From c4ed31b246a2a204b0c09d705d63a400fca72c8d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 27 Sep 2024 02:52:01 -0400 Subject: [PATCH] Fix a bug where force-ending a song could occasionally try to draw destroyed sprites. --- source/funkin/play/PlayState.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 6678cfc3c..7a2b099e4 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -817,6 +817,7 @@ class PlayState extends MusicBeatSubState } else { + this.remove(currentStage); FlxG.switchState(() -> new MainMenuState()); } return false; @@ -965,6 +966,7 @@ class PlayState extends MusicBeatSubState // It's a reference to Gitaroo Man, which doesn't let you pause the game. if (!isSubState && event.gitaroo) { + this.remove(currentStage); FlxG.switchState(() -> new GitarooPause( { targetSong: currentSong, @@ -1366,6 +1368,7 @@ class PlayState extends MusicBeatSubState { funkin.modding.PolymodHandler.forceReloadAssets(); lastParams.targetSong = SongRegistry.instance.fetchEntry(currentSong.id); + this.remove(currentStage); LoadingState.loadPlayState(lastParams); } @@ -2600,6 +2603,7 @@ class PlayState extends MusicBeatSubState } else { + this.remove(currentStage); FlxG.switchState(() -> new ChartEditorState( { targetSongId: currentSong.id, @@ -2949,6 +2953,7 @@ class PlayState extends MusicBeatSubState { targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; } + this.remove(currentStage); LoadingState.loadPlayState( { targetSong: targetSong, @@ -2966,6 +2971,7 @@ class PlayState extends MusicBeatSubState { targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; } + this.remove(currentStage); LoadingState.loadPlayState( { targetSong: targetSong,