From e5a26bb4f126f4ab13fcbdf16648b843f32c720c Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sun, 17 May 2020 20:40:04 -0400 Subject: [PATCH] Another fix for replacing --- .../Interfaces/FileFormatting/IArchiveFile.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Switch_Toolbox_Library/Interfaces/FileFormatting/IArchiveFile.cs b/Switch_Toolbox_Library/Interfaces/FileFormatting/IArchiveFile.cs index d25657c1..d1da3646 100644 --- a/Switch_Toolbox_Library/Interfaces/FileFormatting/IArchiveFile.cs +++ b/Switch_Toolbox_Library/Interfaces/FileFormatting/IArchiveFile.cs @@ -973,18 +973,17 @@ namespace Toolbox.Library { var prevNode = (TreeNode)ArchiveFileInfo.FileFormat; var parent = prevNode.Parent; - if (parent == null) return; - - var index = parent.Nodes.IndexOf(prevNode); - parent.Nodes.RemoveAt(index); - parent.Nodes.Insert(index, this); + if (parent != null) + { + var index = parent.Nodes.IndexOf(prevNode); + parent.Nodes.RemoveAt(index); + parent.Nodes.Insert(index, this); + } } ArchiveFileInfo.FileFormat.Unload(); ArchiveFileInfo.FileFormat = null; Nodes.Clear(); - - ArchiveFileInfo.FileFormat = ArchiveFileInfo.OpenFile(); OpenFileFormat(TreeView); } @@ -1141,6 +1140,9 @@ namespace Toolbox.Library public void UpdateEditor() { + if (ArchiveFileInfo.FileFormat != null) + Console.WriteLine($"UpdateEditor {ArchiveFileInfo.FileFormat.FileName}"); + ArchiveFilePanel editor = (ArchiveFilePanel)LibraryGUI.GetActiveContent(typeof(ArchiveFilePanel)); if (editor == null) {