changeset 164:e0e5af2a934c

Fixes #295: Index out of bounds when changing unit size and clicking in equipment list * Use the only fix that seems to work - unsubscribe and re-subscribe to the selection change so that we don't trigger it when setting an existing value
author IBBoard <dev@ibboard.co.uk>
date Wed, 14 Jul 2010 19:37:30 +0000
parents d533f3b3ba1e
children 2c17714ad71b
files FrmUnit.cs
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/FrmUnit.cs	Mon Jul 05 20:08:39 2010 +0000
+++ b/FrmUnit.cs	Wed Jul 14 19:37:30 2010 +0000
@@ -595,7 +595,10 @@
 
 			if (idx > -1)
 			{
+				//HACK: Unsubscribe and resubscribe to prevent Index Out Of Bounds from selection changed event, as per ticket 295
+				equipmentList.SelectedIndexChanged -= equipmentList_SelectedIndexChanged;
 				equipmentList.Items[idx] = equipChoice;
+				equipmentList.SelectedIndexChanged += equipmentList_SelectedIndexChanged;
 			}
 			else
 			{