mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-02 05:14:30 +00:00
Fix crash when selecting invalid image file types
This commit is contained in:
@@ -906,10 +906,18 @@ namespace PckStudio.Controls
|
||||
case PckAssetType.CapeFile:
|
||||
case PckAssetType.TextureFile:
|
||||
{
|
||||
Image img = asset.GetTexture();
|
||||
|
||||
previewPictureBox.Image = img;
|
||||
labelImageSize.Text = $"{previewPictureBox.Image.Size.Width}x{previewPictureBox.Image.Size.Height}";
|
||||
try
|
||||
{
|
||||
Image img = asset.GetTexture();
|
||||
previewPictureBox.Image = img;
|
||||
labelImageSize.Text = $"{previewPictureBox.Image.Size.Width}x{previewPictureBox.Image.Size.Height}";
|
||||
}
|
||||
catch(System.ArgumentException ex)
|
||||
{
|
||||
previewPictureBox.Image = Resources.NoImageFound;
|
||||
MessageBox.Show(this, "Not a valid .PNG or .TGA image or invalid image data found");
|
||||
}
|
||||
|
||||
if (asset.Type != PckAssetType.TextureFile)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user