mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
optimize<Preference>: use default preference settings when load broken preference data.
This commit is contained in:
parent
39b5cb54fc
commit
17e9ce2a2f
1 changed files with 6 additions and 2 deletions
|
@ -192,11 +192,15 @@ namespace SourceGit.Models {
|
|||
if (!File.Exists(SAVE_PATH)) {
|
||||
instance = new Preference();
|
||||
} else {
|
||||
try {
|
||||
#if NET48
|
||||
instance = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(SAVE_PATH));
|
||||
instance = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(SAVE_PATH));
|
||||
#else
|
||||
instance = JsonSerializer.Deserialize<Preference>(File.ReadAllText(SAVE_PATH));
|
||||
instance = JsonSerializer.Deserialize<Preference>(File.ReadAllText(SAVE_PATH));
|
||||
#endif
|
||||
} catch {
|
||||
instance = new Preference();
|
||||
}
|
||||
}
|
||||
|
||||
if (!instance.IsReady) {
|
||||
|
|
Loading…
Reference in a new issue