mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
handling malformed json (#12942)
This commit is contained in:
committed by
GitHub
parent
46bfd2cdac
commit
d197ddeb15
@@ -408,7 +408,14 @@ namespace ImageResizer.Properties
|
|||||||
}
|
}
|
||||||
|
|
||||||
string jsonData = _fileSystem.File.ReadAllText(SettingsPath);
|
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.
|
// Needs to be called on the App UI thread as the properties are bound to the UI.
|
||||||
App.Current.Dispatcher.Invoke(() =>
|
App.Current.Dispatcher.Invoke(() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user