Skip to content

Commit

Permalink
handling malformed json (#12942)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegiacometti committed Aug 30, 2021
1 parent 46bfd2c commit d197dde
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/imageresizer/ui/Properties/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,14 @@ public void Reload()
}

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(() =>
Expand Down

0 comments on commit d197dde

Please sign in to comment.