changeset 72:9a215113c84c

Re #184: Unhandled exception in the unit form * Perform null check before trying to open "edit" dialog (Fixes the other part of Snowblizz's post) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Mon, 28 Sep 2009 19:40:50 +0000
parents 74d3efaac800
children 12f11e3c6261
files FrmUnit.cs
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/FrmUnit.cs	Mon Sep 28 19:19:34 2009 +0000
+++ b/FrmUnit.cs	Mon Sep 28 19:40:50 2009 +0000
@@ -462,8 +462,13 @@
 
 		private void EditWeapon()
 		{
-			FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, GetSelectedUnitEquipmentItem(), commandStack);
-			editEquip.ShowDialog(this);
+			UnitEquipmentItem item = GetSelectedUnitEquipmentItem();
+
+			if (item != null)
+			{
+				FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack);
+				editEquip.ShowDialog(this);
+			}
 		}
 
 		private UnitEquipmentItem GetSelectedUnitEquipmentItem()