From ab7a65a89b1f8e3ba1bb775fb13e7cb448f08957 Mon Sep 17 00:00:00 2001 From: jradford Date: Fri, 25 Sep 2015 09:59:22 -0700 Subject: [PATCH] Fixes Issue #379 NullReferenceException being thrown on First Run --- SuperPutty/SessionTreeview.cs | 5 ++++- SuperPutty/SuperPuTTY.cs | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SuperPutty/SessionTreeview.cs b/SuperPutty/SessionTreeview.cs index d2839aa0..94da6c8b 100644 --- a/SuperPutty/SessionTreeview.cs +++ b/SuperPutty/SessionTreeview.cs @@ -64,7 +64,10 @@ public SessionTreeview(DockPanel dockPanel) m_DockPanel = dockPanel; InitializeComponent(); this.treeView1.TreeViewNodeSorter = this; - this.treeView1.ImageList = SuperPuTTY.Images; + if (SuperPuTTY.Images != null) + { + this.treeView1.ImageList = SuperPuTTY.Images; + } this.ApplySettings(); // populate sessions in the treeview from the registry diff --git a/SuperPutty/SuperPuTTY.cs b/SuperPutty/SuperPuTTY.cs index 7ad5c9a1..1fc7e57c 100644 --- a/SuperPutty/SuperPuTTY.cs +++ b/SuperPutty/SuperPuTTY.cs @@ -38,7 +38,9 @@ public static void Initialize(string[] args) { Log.InfoFormat( "Initializing. Version={0}, UserSettings={1}, SettingsFolder={2}", - Version, Settings.SettingsFilePath, Settings.SettingsFolder); + Version, Settings.SettingsFilePath, Settings.SettingsFolder); + + Images = LoadImageList("default"); if (!SuperPuTTY.IsFirstRun) { @@ -54,10 +56,9 @@ public static void Initialize(string[] args) } } - // load data + // load data LoadLayouts(); - LoadSessions(); - Images = LoadImageList("default"); + LoadSessions(); // determine starting layout, if any. CLI has priority if (CommandLine.IsValid)