diff FrmUnit.cs @ 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 0e7c257ca8d6
children 1e85a0687e4d
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()