mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Prevent TOUTOC error when reading status model
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user