[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`.
This commit is contained in:
AppleHair 2024-07-16 21:17:53 +03:00 committed by EliteMasterEric
parent 68b7610225
commit 4f46a8e4d0

View file

@ -2150,8 +2150,11 @@ class FreeplaySongData
function updateValues(variations:Array<String>):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;