From 125f70a0b837d0d40fd86726488ff5a41ca9bc0d Mon Sep 17 00:00:00 2001 From: VaDiM Date: Sun, 11 Oct 2026 01:05:09 +0300 Subject: [PATCH] Improve error messages for sprites --- AssetStudioGUI/AssetStudioGUIForm.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 1fa7437..befa274 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -1472,6 +1472,8 @@ namespace AssetStudioGUI var statusStrip = "Unsupported sprite for preview. "; if (converter.Width == 0 || converter.Height == 0) statusStrip += "The width or height of the sprite is 0."; + if (converter.m_Texture2D == null) + statusStrip += "Unable to find related Texture2D asset."; StatusStripUpdate(statusStrip); } } @@ -1903,7 +1905,7 @@ namespace AssetStudioGUI { var selectedAsset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]]; var spriteConverter = new SpriteConverter((Sprite)selectedAsset.Asset); - var textureAsset = visibleAssets.Find(x => x.Type == ClassIDType.Texture2D && x.m_PathID == spriteConverter.m_Texture2D.m_PathID); + var textureAsset = visibleAssets.Find(x => x.Type == ClassIDType.Texture2D && x.m_PathID == spriteConverter.m_Texture2D?.m_PathID); if (textureAsset != null) { var listViewItem = assetListView.Items[assetListView.Items.IndexOf(textureAsset)];