From eac6d122234e8c5c93b7baa04017b87e5c655a79 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 10 Oct 2005 16:40:58 +0000 Subject: [PATCH] * ResourceListBox.cs: Don't crash on click if there are no items selected. svn path=/trunk/winforms-tools/; revision=51521 --- MWFResourceEditor/Changelog | 5 +++++ MWFResourceEditor/ResourceListBox.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MWFResourceEditor/Changelog b/MWFResourceEditor/Changelog index 9f6b1fc..452a82d 100644 --- a/MWFResourceEditor/Changelog +++ b/MWFResourceEditor/Changelog @@ -1,3 +1,8 @@ +2005-10-10 Jackson Harper + + * ResourceListBox.cs: Don't crash on click if there are no + items selected. + 2005-10-09 Alexander Olk * Makefile: Updated diff --git a/MWFResourceEditor/ResourceListBox.cs b/MWFResourceEditor/ResourceListBox.cs index 6eee6b8..61d2cdb 100644 --- a/MWFResourceEditor/ResourceListBox.cs +++ b/MWFResourceEditor/ResourceListBox.cs @@ -305,9 +305,10 @@ namespace MWFResourceEditor protected override void OnClick( EventArgs e ) { - if ( SelectedIndex != old_selected_index ) + if ( SelectedIndex != -1 && SelectedIndex != old_selected_index ) { old_selected_index = SelectedIndex; + Console.WriteLine ("Selected Index: " + SelectedIndex); resourceTreeView.ShowItem( Items[ SelectedIndex ] as IResource, showType ); } base.OnClick( e );