From 69499d545567a43e58a1e4ce6fb815bf11187a87 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sun, 3 Nov 2024 11:46:42 -0500 Subject: [PATCH] Improve reliability when GlobalCache can't be loaded #63 --- FreePackages/Data/GlobalCache.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FreePackages/Data/GlobalCache.cs b/FreePackages/Data/GlobalCache.cs index 7cbaf39..cb668e9 100644 --- a/FreePackages/Data/GlobalCache.cs +++ b/FreePackages/Data/GlobalCache.cs @@ -26,7 +26,7 @@ internal GlobalCache() { protected override Task Save() => Save(this); - internal static async Task CreateOrLoad() { + internal static async Task CreateOrLoad() { if (!File.Exists(SharedFilePath)) { return new GlobalCache(); } @@ -38,20 +38,20 @@ internal GlobalCache() { if (string.IsNullOrEmpty(json)) { ASF.ArchiLogger.LogGenericError(string.Format(ArchiSteamFarm.Localization.Strings.ErrorIsEmpty, nameof(json))); - return null; + return new GlobalCache(); } globalCache = json.ToJsonObject(); } catch (Exception e) { ASF.ArchiLogger.LogGenericException(e); - return null; + return new GlobalCache(); } if (globalCache == null) { ASF.ArchiLogger.LogNullError(globalCache); - return null; + return new GlobalCache(); } return globalCache;