From cb81371b4acaffe26ae16de03cd1a0b91f83ba2f Mon Sep 17 00:00:00 2001
From: Eric <ericmyllyoja@gmail.com>
Date: Mon, 28 Aug 2023 15:07:51 -0400
Subject: [PATCH] Fix an occasional bug where "default" will be used over ""
 causing a crash on song load. (#135)

---
 source/funkin/play/song/Song.hx     | 4 ++--
 source/funkin/play/song/SongData.hx | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx
index 63610950f..715629a51 100644
--- a/source/funkin/play/song/Song.hx
+++ b/source/funkin/play/song/Song.hx
@@ -361,7 +361,7 @@ class SongDifficulty
 
   public inline function playInst(volume:Float = 1.0, looped:Bool = false):Void
   {
-    var suffix:String = (variation ?? '') != '' ? '-$variation' : '';
+    var suffix:String = (variation != null && variation != '' && variation != 'default') ? '-$variation' : '';
     FlxG.sound.playMusic(Paths.inst(this.song.songId, suffix), volume, looped);
   }
 
@@ -392,7 +392,7 @@ class SongDifficulty
       return [];
     }
 
-    var suffix:String = (variation ?? '') != '' ? '-$variation' : '';
+    var suffix:String = (variation != null && variation != '' && variation != 'default') ? '-$variation' : '';
 
     // Automatically resolve voices by removing suffixes.
     // For example, if `Voices-bf-car.ogg` does not exist, check for `Voices-bf.ogg`.
diff --git a/source/funkin/play/song/SongData.hx b/source/funkin/play/song/SongData.hx
index bf574c399..cef4c98f6 100644
--- a/source/funkin/play/song/SongData.hx
+++ b/source/funkin/play/song/SongData.hx
@@ -242,7 +242,7 @@ class SongDataParser
 
   static function loadSongChartDataFile(songPath:String, variation:String = ''):String
   {
-    var songChartDataFilePath:String = (variation != '' || variation == 'default') ? Paths.json('$SONG_DATA_PATH$songPath/$songPath-chart-$variation') : Paths.json('$SONG_DATA_PATH$songPath/$songPath-chart');
+    var songChartDataFilePath:String = (variation != '' && variation != 'default') ? Paths.json('$SONG_DATA_PATH$songPath/$songPath-chart-$variation') : Paths.json('$SONG_DATA_PATH$songPath/$songPath-chart');
 
     var rawJson:String = Assets.getText(songChartDataFilePath).trim();