From 4f46a8e4d06207f2c12ade56cc54aeaa7136e84e Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Tue, 16 Jul 2024 21:17:53 +0300 Subject: [PATCH] [BUGFIX] Prevented infinite recursion on freeplay when a song doesn't have the `normal` difficulty Any attempt to create a song without the `normal` difficulty will result in a silent crash when opening freeplay. After some debugging, I discovered that the issue is caused by infinite recursion, which gets triggered at the start of `FreeplaySongData`'s `updateValues`. --- source/funkin/ui/freeplay/FreeplayState.hx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 690e3b910..a416dbf19 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -2150,8 +2150,11 @@ class FreeplaySongData function updateValues(variations:Array):Void { - this.songDifficulties = song.listSuffixedDifficulties(variations, false, false); - if (!this.songDifficulties.contains(currentDifficulty)) currentDifficulty = Constants.DEFAULT_DIFFICULTY; + this.songDifficulties = song.listDifficulties(null, variations, false, false); + if (!this.songDifficulties.contains(currentDifficulty) && currentDifficulty != Constants.DEFAULT_DIFFICULTY) + { + currentDifficulty = Constants.DEFAULT_DIFFICULTY; + } var songDifficulty:SongDifficulty = song.getDifficulty(currentDifficulty, null, variations); if (songDifficulty == null) return;