Browse Source

Added a webhook handler if updated is null and refresh entire palette list

CPKreuz 1 year ago
parent
commit
4fb9f59287
1 changed files with 17 additions and 0 deletions
  1. 17 0
      src/PixiEditor/Models/DataProviders/LocalPalettesFetcher.cs

+ 17 - 0
src/PixiEditor/Models/DataProviders/LocalPalettesFetcher.cs

@@ -220,6 +220,23 @@ internal class LocalPalettesFetcher : PaletteListDataSource
             default:
                 throw new ArgumentOutOfRangeException(nameof(refreshType), refreshType, null);
         }
+
+        if (refreshType is RefreshType.Created or RefreshType.Updated && updated == null)
+        {
+            await RefreshCacheAll();
+            
+            try
+            {
+                throw new NullReferenceException($"The '{nameof(updated)}' was null even though the refresh type was '{refreshType}'.");
+            }
+            catch (Exception e)
+            {
+                await CrashHelper.SendExceptionInfoToWebhookAsync(e);
+            }
+
+            return;
+        }
+        
         CacheUpdated?.Invoke(refreshType, updated, affectedFileName);
     }