Ryujinx icon indicating copy to clipboard operation
Ryujinx copied to clipboard

Catch Profile.json parse to prevent crash on launch

Open PhiZero opened this issue 2 years ago • 1 comments

Handles the Profile JSON parsing in a try catch so the application does not crash on launch, but instead loads the default profile.

Closes #3355.

PhiZero avatar Jun 12 '22 03:06 PhiZero

Sorry, this PR completely slipped my mind.

@AcK77 Is there anything you'd like me to address? I don't think anything needs to be cleaned, the existing Profiles.json will just get populated with a working profile again. The orphaned save files are an issue, but at this point the JSON is already corrupted. On top of that, I think the save manager will help users with recovering their saves now.

PhiZero avatar Jan 20 '23 01:01 PhiZero

@AcK77 Is there anything you'd like me to address? I don't think anything needs to be cleaned, the existing Profiles.json will just get populated with a working profile again. The orphaned save files are an issue, but at this point the JSON is already corrupted. On top of that, I think the save manager will help users with recovering their saves now.

You only assign the default UserId if the parsing failed (LastOpened = AccountManager.DefaultUserId). So the Profiles.json will not be populated with a working profile except if I miss something. I agree for the orphaned save files, those could be recovered by the save manager now ;)

AcK77 avatar Jan 20 '23 21:01 AcK77

@AcK77 I just tried it and when I break the json (just {} as content), the catch picks it up and generates a default RyuPlayer profile with: "user_id": "00000000000000010000000000000000", "last_opened": "00000000000000010000000000000000"

This is the default UserId as far as I'm aware?

PhiZero avatar Jan 20 '23 21:01 PhiZero

@AcK77 I just tried it and when I break the json (just {} as content), the catch picks it up and generates a default RyuPlayer profile with: "user_id": "00000000000000010000000000000000", "last_opened": "00000000000000010000000000000000"

This is the default UserId as far as I'm aware?

After a quick check, it's because the user is opened as default, so it's save the JSON to write the account state. Your change should be enough (with my latest comment applied).

AcK77 avatar Jan 20 '23 23:01 AcK77