Skip to content

Commit

Permalink
Fix: Fixed crash that would occur when settings file was invalid (#13853
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yaira2 authored Nov 13, 2023
1 parent 04dde27 commit 1fa4b59
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ public DefaultJsonSettingsDatabase(ISettingsSerializer settingsSerializer, IJson
data = "null";
}

return JsonSettingsSerializer.DeserializeFromJson<ConcurrentDictionary<string, object?>?>(data) ?? new();
try
{
return JsonSettingsSerializer.DeserializeFromJson<ConcurrentDictionary<string, object?>?>(data) ?? new();
}
catch (Exception)
{
// Occurs if the settings file has invalid json
// TODO Display prompt to notify user #710
return JsonSettingsSerializer.DeserializeFromJson<ConcurrentDictionary<string, object?>?>("null") ?? new();
}
}

protected bool SaveSettings(IDictionary<string, object?> data)
Expand Down

0 comments on commit 1fa4b59

Please sign in to comment.