Prevent TOUTOC error when reading status model

This commit is contained in:
Yoshi Askharoun
2023-09-04 10:51:50 -05:00
parent b121adfebc
commit f4d1a21404
+6 -3
View File
@@ -75,18 +75,21 @@ namespace ZuneModCore
private static StatusModel GetOrCreateStatusModel()
{
StatusModel? model = null;
if (File.Exists(CoreStatusFile))
try
{
string json = File.ReadAllText(CoreStatusFile);
if (!string.IsNullOrWhiteSpace(json))
model = JsonSerializer.Deserialize<StatusModel>(json);
}
model ??= new()
catch
{
model = new()
{
Version = CurrentVersion,
InstalledMods = new()
};
}
Guard.IsNotNull(model, nameof(model));
return model;