mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08: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)) {
|
if (!File.Exists(SAVE_PATH)) {
|
||||||
instance = new Preference();
|
instance = new Preference();
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
#if NET48
|
#if NET48
|
||||||
instance = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(SAVE_PATH));
|
instance = JsonConvert.DeserializeObject<Preference>(File.ReadAllText(SAVE_PATH));
|
||||||
#else
|
#else
|
||||||
instance = JsonSerializer.Deserialize<Preference>(File.ReadAllText(SAVE_PATH));
|
instance = JsonSerializer.Deserialize<Preference>(File.ReadAllText(SAVE_PATH));
|
||||||
#endif
|
#endif
|
||||||
|
} catch {
|
||||||
|
instance = new Preference();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.IsReady) {
|
if (!instance.IsReady) {
|
||||||
|
|
Loading…
Reference in a new issue