Skip to content

Commit 6583928

Browse files
committed
Quick fix crash freeplay
1 parent d2a1139 commit 6583928

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

source/funkin/backend/chart/Chart.hx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class Chart {
8383
return data;
8484
}
8585

86-
public static function loadChartMeta(songName:String, ?difficulty:String, fromMods:Bool = true, includeMetaDifficulties:Bool = false):ChartMetaData {
87-
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
86+
public static function loadChartMeta(songName:String, difficulty:String = '', fromMods:Bool = true, includeMetaDifficulties:Bool = true):ChartMetaData {
87+
trace(songName, difficulty, fromMods, includeMetaDifficulties);
8888

8989
var metaPath = Paths.file('songs/${songName}/meta.json');
9090
var metaDiffPath = Paths.file('songs/${songName}/meta-${difficulty}.json');
@@ -141,8 +141,10 @@ class Chart {
141141

142142
if (includeMetaDifficulties && !fromDifficulty) {
143143
data.metas = [];
144-
for (difficulty in data.difficulties) if (!data.metas.exists(difficulty) && Assets.exists(Paths.file('songs/${songName}/meta-${difficulty}.json')))
145-
data.metas.set(difficulty, loadChartMeta(songName, difficulty, fromMods, false));
144+
for (difficulty in data.difficulties) {
145+
if (!data.metas.exists(difficulty) && Assets.exists(Paths.file('songs/${songName}/meta-${difficulty}.json')))
146+
data.metas.set(difficulty, loadChartMeta(songName, difficulty, fromMods, false));
147+
}
146148
}
147149

148150
return data;

source/funkin/menus/FreeplayState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class FreeplayState extends MusicBeatState
492492
curSong = null;
493493
curSongDifficulty = null;
494494
}
495-
else if ((curSong = song.metas.get(curSongDifficulty = curSong.difficulties[curDifficulty])) == null)
495+
else if ((curSong = song.metas.get(curSongDifficulty = song.difficulties[curDifficulty])) == null)
496496
curSong = song;
497497
}
498498
}

0 commit comments

Comments
 (0)