Skip to content

Commit a7f4fe1

Browse files
committed
Small bug fix
Additional check to avoid System.InvalidCastException
1 parent 79b991c commit a7f4fe1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Tools/SPRTYL2PNG/MainWindow.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ private void UpdatePreviewPanel()
5656
previewPanel.Children.Add(spriteImage[i]);
5757
}
5858

59-
var tg = (TileSet)loadedGraphics;
60-
if (tg.TileSetGroupInformation != null)
59+
TileSet tg = null;
60+
61+
if(loadedGraphics is TileSet)
62+
tg = (TileSet)loadedGraphics;
63+
64+
if (tg != null && tg.TileSetGroupInformation != null)
6165
{
6266
tileColumnDef.Width = new GridLength(250);
6367
var spriteTileImage = new Image[tg.TileSetGroupInformation.Length];

0 commit comments

Comments
 (0)