fix json file not exists case
This commit is contained in:
@@ -22,7 +22,7 @@ namespace OwnChar.Data.Providers.JsonFile
|
|||||||
|
|
||||||
protected void LoadFile()
|
protected void LoadFile()
|
||||||
{
|
{
|
||||||
if (JsonConvert.DeserializeObject<JsonFile>(File.ReadAllText(JsonFilePath), CreateJsonSerializerSettings()) is JsonFile jsonFile)
|
if (File.Exists(JsonFilePath) && JsonConvert.DeserializeObject<JsonFile>(File.ReadAllText(JsonFilePath), CreateJsonSerializerSettings()) is JsonFile jsonFile)
|
||||||
JsonFile = jsonFile;
|
JsonFile = jsonFile;
|
||||||
JsonFile ??= new();
|
JsonFile ??= new();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user