From 6becb6054a3dad291777788a4c036c12f3adda7a Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 15 May 2020 05:15:13 -0400 Subject: [PATCH] support adding bookmarks to files that may not have Editor.ObjectModel.Accessor set for whatever reason --- Libraries/UniversalEditor.UserInterface/Engine.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/UniversalEditor.UserInterface/Engine.cs b/Libraries/UniversalEditor.UserInterface/Engine.cs index 46d12c3c..19161160 100644 --- a/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -511,11 +511,13 @@ namespace UniversalEditor.UserInterface Editor ed = LastWindow.GetCurrentEditor(); if (ed == null) return; + Accessor acc = ed.ObjectModel?.Accessor ?? (ed.Parent as Pages.EditorPage)?.Document?.Accessor; + // we cannot yet bookmark a file that does not yet exist. (this would be akin to creating a shortcut to a template I guess...?) - if (ed.ObjectModel.Accessor == null) return; + if (acc == null) return; // FIXME: BookmarksAdd copypasta - string filename = ed.ObjectModel.Accessor.GetFileName(); + string filename = acc.GetFileName(); BookmarksManager.FileNames.Add(filename); Command cmdBookmarks = Application.Commands["Bookmarks"];