mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-18 05:28:07 +08:00
handling malformed json (#12942)
This commit is contained in:
parent
46bfd2cdac
commit
d197ddeb15
@ -408,7 +408,14 @@ namespace ImageResizer.Properties
|
||||
}
|
||||
|
||||
string jsonData = _fileSystem.File.ReadAllText(SettingsPath);
|
||||
Settings jsonSettings = JsonSerializer.Deserialize<SettingsWrapper>(jsonData)?.Properties;
|
||||
var jsonSettings = new Settings();
|
||||
try
|
||||
{
|
||||
jsonSettings = JsonSerializer.Deserialize<SettingsWrapper>(jsonData)?.Properties;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
}
|
||||
|
||||
// Needs to be called on the App UI thread as the properties are bound to the UI.
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
|
Loading…
Reference in New Issue
Block a user