Skip to content

fix: Handle the case of a corrupt JSON config#101

Merged
RubenBroere merged 3 commits into
TeamWheelWizard:devfrom
matellush:fix/corrupt-json
Apr 4, 2025
Merged

fix: Handle the case of a corrupt JSON config#101
RubenBroere merged 3 commits into
TeamWheelWizard:devfrom
matellush:fix/corrupt-json

Conversation

@matellush
Copy link
Copy Markdown
Collaborator

@matellush matellush commented Apr 4, 2025

Purpose of this PR:

Fix the bug where a corrupt config.json file (filled with \0 bytes, for example) would crash WheelWizard.

How to Test:

Write a single \0 byte at the start of the JSON file and remove all other contents. Then open WheelWizard – it should not crash anymore but log the exception and the loaded config is empty. Entering the settings again and hitting save should overwrite the file in a way that the \0 byte is gone.

What Has Been Changed:

The initial setup of the application was rewritten to pass the service provider to the LoadSettings method (for logging purposes).

Related Issue Link:

#100

Checklist before merging

  • You have created relevant tests

Comment thread WheelWizard/Program.cs Outdated
Comment thread WheelWizard/Services/Settings/WhWzSettingManager.cs Outdated
Comment thread WheelWizard/Program.cs
@RubenBroere RubenBroere merged commit 928220a into TeamWheelWizard:dev Apr 4, 2025
@matellush matellush deleted the fix/corrupt-json branch April 4, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants