From f6b898c1b673fb32eb9680afceadbf152534ad91 Mon Sep 17 00:00:00 2001 From: alcexhim Date: Tue, 5 May 2015 07:56:12 -0400 Subject: [PATCH] Prevent crashes under certain conditions --- .../Editors/FileSystemEditor.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/FileSystemEditor.cs b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/FileSystemEditor.cs index 0af70190..9f986cb9 100644 --- a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/FileSystemEditor.cs +++ b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/FileSystemEditor.cs @@ -766,8 +766,9 @@ namespace UniversalEditor.UserInterface.WindowsForms.Editors { if (lv.SelectedItems.Count == 0) { - string fileName = ObjectModel.Accessor.GetFileName(); - if (System.IO.File.Exists(fileName)) + string fileName = null; + if (ObjectModel.Accessor != null) fileName = ObjectModel.Accessor.GetFileName(); + if (!String.IsNullOrEmpty(fileName) && System.IO.File.Exists(fileName)) { File file = new File(); file.Name = fileName; @@ -792,6 +793,10 @@ namespace UniversalEditor.UserInterface.WindowsForms.Editors if (file != null) { Dialogs.FileSystem.FilePropertiesDialog dlg = new Dialogs.FileSystem.FilePropertiesDialog(); + if (ObjectModel.Accessor != null) + { + dlg.ParentFileName = ObjectModel.Accessor.GetFileName(); + } dlg.SelectedObjects.Add(file); if (dlg.ShowDialog() == DialogResult.OK)