From 347340c13faf471f312ab27190e9ad89fcccb843 Mon Sep 17 00:00:00 2001 From: VladiStep Date: Fri, 4 Nov 2022 16:33:15 +0300 Subject: [PATCH] Fix of a crash for GMS 2 object instance with empty sprite. --- UndertaleModTool/Editors/UndertaleRoomEditor.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UndertaleModTool/Editors/UndertaleRoomEditor.xaml.cs b/UndertaleModTool/Editors/UndertaleRoomEditor.xaml.cs index d90ca8334..dfc545e4f 100644 --- a/UndertaleModTool/Editors/UndertaleRoomEditor.xaml.cs +++ b/UndertaleModTool/Editors/UndertaleRoomEditor.xaml.cs @@ -1468,7 +1468,9 @@ public static void GenerateSpriteCache(UndertaleRoom room) break; case LayerType.Instances: - allObjects.AddRange(layer.InstancesData.Instances); + var instances = layer.InstancesData.Instances + .Where(g => g.ObjectDefinition?.Sprite?.Textures.Count > 0); + allObjects.AddRange(instances); break; } }