mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-13 16:00:17 +00:00
Catch Profile.json parse to prevent crash on launch
This commit is contained in:
parent
70895bdb04
commit
90d249450b
1 changed files with 17 additions and 7 deletions
|
@ -1,5 +1,7 @@
|
|||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
|
||||
if (File.Exists(_profilesJsonPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
ProfilesJson profilesJson = JsonHelper.DeserializeFromFile<ProfilesJson>(_profilesJsonPath);
|
||||
|
||||
|
@ -54,6 +58,12 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
|||
|
||||
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
|
||||
{
|
||||
LastOpened = AccountManager.DefaultUserId;
|
||||
|
|
Loading…
Reference in a new issue