diff --git a/AppScaffolding/AppScaffolding.csproj b/AppScaffolding/AppScaffolding.csproj index 7349b2a6..3910d142 100644 --- a/AppScaffolding/AppScaffolding.csproj +++ b/AppScaffolding/AppScaffolding.csproj @@ -3,7 +3,7 @@ net6.0 - 6.7.5.1 + 6.7.6.2 diff --git a/LibationFileManager/TagsPersistence.cs b/LibationFileManager/TagsPersistence.cs index d04f2fcc..add10407 100644 --- a/LibationFileManager/TagsPersistence.cs +++ b/LibationFileManager/TagsPersistence.cs @@ -54,11 +54,17 @@ namespace LibationFileManager private static void ensureCache() { - if (cache is null) - lock (locker) - cache = !File.Exists(TagsFile) - ? new Dictionary() - : JsonConvert.DeserializeObject>(File.ReadAllText(TagsFile)); + if (cache is not null) + return; + + lock (locker) + { + if (File.Exists(TagsFile)) + cache = JsonConvert.DeserializeObject>(File.ReadAllText(TagsFile)); + + // if file doesn't exist. or if file is corrupt and deserialize returns null + cache ??= new Dictionary(); + } } } }