From b847212375ea4740a8b175a25ac95886fd988cfb Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 10 Jun 2023 03:59:25 -0400 Subject: [PATCH] Migrator fixes --- source/funkin/play/song/SongMigrator.hx | 17 ----------------- source/funkin/util/SerializerUtil.hx | 11 ++++++++++- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/source/funkin/play/song/SongMigrator.hx b/source/funkin/play/song/SongMigrator.hx index 81500406d..f561c4d3e 100644 --- a/source/funkin/play/song/SongMigrator.hx +++ b/source/funkin/play/song/SongMigrator.hx @@ -108,23 +108,6 @@ class SongMigrator trace('Migrating song metadata from FNF Legacy.'); var songData:FNFLegacy = cast jsonData; - // Some cleanup - if (Std.isOfType(jsonData.song.notes, Array)) - { - jsonData.song.notes = haxe.ds.Either.Left(jsonData.song.notes); - } - else - { - jsonData.song.notes = haxe.ds.Either.Right(jsonData.song.notes); - } - if (Std.isOfType(jsonData.song.speed, Float)) - { - jsonData.song.speed = haxe.ds.Either.Left(jsonData.song.speed); - } - else - { - jsonData.song.speed = haxe.ds.Either.Right(jsonData.song.speed); - } var songMetadata:SongMetadata = new SongMetadata('Import', 'Kawai Sprite', 'default'); diff --git a/source/funkin/util/SerializerUtil.hx b/source/funkin/util/SerializerUtil.hx index 662c05250..9452b7785 100644 --- a/source/funkin/util/SerializerUtil.hx +++ b/source/funkin/util/SerializerUtil.hx @@ -44,7 +44,16 @@ class SerializerUtil */ public static function fromJSONBytes(input:Bytes):Dynamic { - return Json.parse(input.toString()); + try + { + return Json.parse(input.toString()); + } + catch (e:Dynamic) + { + trace('An error occurred while parsing JSON from byte data'); + trace(e); + return null; + } } /**