diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 91ebef25d..cdf3daa7c 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -497,6 +497,8 @@ class FreeplayState extends MusicBeatSubState // Reminder, this is a callback function being set, rather than these being called here in create() letterSort.changeSelectionCallback = (str) -> { + var curSong:Null = grpCapsules.members[curSelected]?.freeplayData; + switch (str) { case 'fav': @@ -509,9 +511,14 @@ class FreeplayState extends MusicBeatSubState generateSongList({filterType: REGEXP, filterData: str}, true); } - // We want to land on the first song of the group, rather than random song when changing letter sorts + // If the current song is still in the list (aka not null?), we'll land on it + // Otherwise we want to land on the first song of the group, rather than random song when changing letter sorts // that is, only if there's more than one song in the group! - if (grpCapsules.members.length > 0) + if (curSong != null && currentFilteredSongs.length > 1) + { + changeSelection(); + } + else if (grpCapsules.members.length > 0) { FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4); curSelected = 1;