From d800339e215f1bb71d649ee429874860291cd7ca Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:24:03 +0200 Subject: [PATCH] MainForm.cs - File Type Handlers now no longer have to check if data is available --- PCK-Studio/MainForm.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index bab6b3c1..335c9194 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -407,20 +407,12 @@ namespace PckStudio private void HandleColourFile(PckFile.FileData file) { - if (file.Size == 0) - { - MessageBox.Show("No Color data found.", "Error", MessageBoxButtons.OK, - MessageBoxIcon.Error); - return; - } using COLEditor diag = new COLEditor(file); wasModified = diag.ShowDialog(this) == DialogResult.OK; } public void HandleSkinFile(PckFile.FileData file) { - if (file.Size <= 0) - return; using (var ms = new MemoryStream(file.Data)) { var texture = Image.FromStream(ms); @@ -965,6 +957,11 @@ namespace PckStudio { if (treeViewMain.SelectedNode is TreeNode t && t.Tag is PckFile.FileData file) { + if (file.Size <= 0) + { + Debug.WriteLine($"'{file.Filename}' has no data attached.", category: nameof(HandleTextureFile)); + return; + } pckFileTypeHandler[file.Filetype]?.Invoke(file); } }