From 07aaeb2d47b12c3f48c35b03f3caf892a0ab3e14 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 20 Dec 2019 07:36:11 -0500 Subject: [PATCH] don't load NULL documents, associate EditorPage.Document properly, EditorPage.Document SHOULD load document properly but it doesn't --- .../UniversalEditor.UserInterface/MainWindow.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs b/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs index d9bbc0af..75b3896b 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs @@ -431,6 +431,8 @@ namespace UniversalEditor.UserInterface private void InitEditorPage(Document doc) { + if (doc == null) return; + bool loaded = false; if (doc.DataFormat == null) { @@ -575,6 +577,9 @@ namespace UniversalEditor.UserInterface List indices = new List(); for (int i = 0; i < pages.Length; i++) { + if (pages[i].Document == null) + continue; + if (!pages[i].Document.IsChanged) continue; @@ -676,7 +681,12 @@ namespace UniversalEditor.UserInterface if (ed == null) return; EditorPage page = new EditorPage(); + page.Document = new Document(ed.ObjectModel, null, new FileAccessor(filename)); + + // HACK til we can properly fix this + page.Controls.Clear(); page.Controls.Add(ed, new BoxLayout.Constraints(true, true)); + page.DocumentEdited += page_DocumentEdited; InitDocTab(filename, System.IO.Path.GetFileName(filename), page);