Skip to content

Fix: Prevent crash on fresh startup #10031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2022
Merged

Fix: Prevent crash on fresh startup #10031

merged 2 commits into from
Sep 21, 2022

Conversation

lukeblevins
Copy link
Contributor

Presently, we assume that a null return value for ReadFromFile() is possible. This assumption causes a crash on startup when incorrectly attempting to deserialize the empty string returned on a fresh installation. This PR makes no changes to the ReadFromFile() method body, as that is out of scope, but instead adjusts the return type to not statically assert null values are possible. Additionally, we will now test for both null and string.Empty in DefaultJsonSettingsDatabase to fix the issue, while ensuring maximum compatibility with future changes to the ReadFromFile() method.

Validation
How did you test these changes?

  • Built and ran the app
  • Tested the changes for accessibility

@yaira2 yaira2 changed the title Bug: Prevent crash on fresh startup Fix: Prevent crash on fresh startup Sep 21, 2022
Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Sep 21, 2022
@yaira2 yaira2 merged commit f144270 into files-community:main Sep 21, 2022
@lukeblevins lukeblevins deleted the dev/lubl/json-issue branch September 21, 2022 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants