2
0
Эх сурвалжийг харах

Fixed group delete from context menu

flabbet 4 жил өмнө
parent
commit
142b401a35

+ 6 - 2
PixiEditor/Models/Layers/LayerStructure.cs

@@ -639,8 +639,12 @@ namespace PixiEditor.Models.Layers
         {
             foreach (var currentGroup in groups)
             {
-                int topIndex = Owner.Layers.IndexOf(Owner.Layers.First(x => x.LayerGuid == currentGroup.EndLayerGuid));
-                int bottomIndex = Owner.Layers.IndexOf(Owner.Layers.First(x => x.LayerGuid == currentGroup.StartLayerGuid));
+                var endLayer = Owner.Layers.FirstOrDefault(x => x.LayerGuid == currentGroup.EndLayerGuid);
+                var startLayer = Owner.Layers.FirstOrDefault(x => x.LayerGuid == currentGroup.StartLayerGuid);
+                if (endLayer == null || startLayer == null) continue;
+
+                int topIndex = Owner.Layers.IndexOf(endLayer);
+                int bottomIndex = Owner.Layers.IndexOf(startLayer);
                 var layers = GetLayersInOrder(new GroupData(topIndex, bottomIndex));
 
                 if (currentGroup.Subgroups.Count > 0)