From c83bd7f655286c55a8d7b9699b74d8e08bb2c901 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:57:28 +0200 Subject: [PATCH] Replace try catch with if case when checking ANIM for ANIMEditor --- MinecraftUSkinEditor/MainForm.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/MinecraftUSkinEditor/MainForm.cs b/MinecraftUSkinEditor/MainForm.cs index 3dc4b2f3..774603dc 100644 --- a/MinecraftUSkinEditor/MainForm.cs +++ b/MinecraftUSkinEditor/MainForm.cs @@ -640,23 +640,16 @@ namespace PckStudio PCKFile.FileData file = (PCKFile.FileData)treeViewMain.SelectedNode.Tag; var property = (ValueTuple)treeMeta.SelectedNode.Tag; int i = file.properties.IndexOf(property); - if (property.Item1 == "ANIM") + if (property.Item1 == "ANIM" && i != -1) { - Forms.Utilities.Skins.ANIMEditor diag = new Forms.Utilities.Skins.ANIMEditor(property.Item2); - try + using Forms.Utilities.Skins.ANIMEditor diag = new Forms.Utilities.Skins.ANIMEditor(property.Item2); + if (diag.ShowDialog(this) == DialogResult.OK && diag.saved) { - diag.ShowDialog(this); - if (!diag.saved) return; file.properties[i] = new ValueTuple("ANIM", diag.outANIM); ReloadMetaTreeView(); saved = false; return; } - catch (Exception ex) - { - MessageBox.Show("This is not a valid ANIM value", "Invalid Input"); - Console.WriteLine("ANIM parsing failed, move to Rename prompt"); - } } using addMeta add = new addMeta(property.Item1, property.Item2); if (add.ShowDialog() == DialogResult.OK && i != -1)