mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-19 21:52:22 +00:00
Catch Profile.json parse to prevent crash on launch (#3393)
* Catch Profile.json parse to prevent crash on launch * Update Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: PhiZero <wolkan.craanen@gmail.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
a76eaf9a9a
commit
dd7a924596
|
@ -1,5 +1,7 @@
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -42,6 +44,8 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
// TODO: Use 0x8000000000000010 system savedata instead of a JSON file if needed.
|
// TODO: Use 0x8000000000000010 system savedata instead of a JSON file if needed.
|
||||||
|
|
||||||
if (File.Exists(_profilesJsonPath))
|
if (File.Exists(_profilesJsonPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ProfilesJson profilesJson = JsonHelper.DeserializeFromFile<ProfilesJson>(_profilesJsonPath);
|
ProfilesJson profilesJson = JsonHelper.DeserializeFromFile<ProfilesJson>(_profilesJsonPath);
|
||||||
|
|
||||||
|
@ -54,6 +58,13 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
|
|
||||||
LastOpened = new UserId(profilesJson.LastOpened);
|
LastOpened = new UserId(profilesJson.LastOpened);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, $"Failed to parse {_profilesJsonPath}: {e.Message} Loading default profile!");
|
||||||
|
|
||||||
|
LastOpened = AccountManager.DefaultUserId;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LastOpened = AccountManager.DefaultUserId;
|
LastOpened = AccountManager.DefaultUserId;
|
||||||
|
|
Loading…
Reference in a new issue