Migrator fixes

This commit is contained in:
EliteMasterEric 2023-06-10 03:59:25 -04:00
parent 6f846751c7
commit b847212375
2 changed files with 10 additions and 18 deletions

View file

@ -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');

View file

@ -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;
}
}
/**