divvun / divvun-manager-windows

Windows package manager client for the Páhkat repository format
GNU General Public License v3.0
2 stars 2 forks source link

System.NullReferenceException when running Divvun Manager with an invalid config file #42

Closed Eijebong closed 2 years ago

Eijebong commented 2 years ago

Sentry ref: DIVVUN-MANAGER-WINDOWS-61

Repro steps:

a632f91c-3178-42b8-9f8d-d429dec3f88c

Reason:

This fails because the settings don't match the required model:

https://github.com/divvun/divvun-manager-windows/blob/849888f3b88ceb0a32a0ee8e1f6e6560ec26b1ba/Divvun.Installer/Models/Settings.cs#L34

Then this is called on startup: https://github.com/divvun/divvun-manager-windows/blob/849888f3b88ceb0a32a0ee8e1f6e6560ec26b1ba/Divvun.Installer/Models/Settings.cs#L44 by https://github.com/divvun/divvun-manager-windows/blob/849888f3b88ceb0a32a0ee8e1f6e6560ec26b1ba/Divvun.Installer/App.xaml.cs#L183

which tries to access file.language but file is a null ref.

Possible solution: Catch the JSON deserialize error and put a default object in _state in that case.

Eijebong commented 2 years ago

Other sentry ref caused by this: DIVVUN-MANAGER-WINDOWS-3Y