瀏覽代碼

Fix crash when TransformSelectedArea_UpdateableChange fails validation

Equbuxu 1 年之前
父節點
當前提交
af484aba77

+ 6 - 2
src/PixiEditor.ChangeableDocument/Changes/Drawing/TransformSelectedArea_UpdateableChange.cs

@@ -177,9 +177,13 @@ internal class TransformSelectedArea_UpdateableChange : UpdateableChange
     {
         if (hasEnqueudImages)
             throw new InvalidOperationException("Attempted to dispose the change while it's internally stored image is still used enqueued in some ChunkyImage. Most likely someone tried to dispose a change after ApplyTemporarily was called but before the subsequent call to Apply. Don't do that.");
-        foreach (var (_, (image, _)) in images!)
+
+        if (images is not null)
         {
-            image.Dispose();
+            foreach (var (_, (image, _)) in images)
+            {
+                image.Dispose();
+            }
         }
 
         if (savedChunks is not null)