changeset 71:74d3efaac800

Fixes #184: Unhandled exception in the unit form * Perform null check before seeing if selected item is required
author IBBoard <dev@ibboard.co.uk>
date Mon, 28 Sep 2009 19:19:34 +0000
parents a8667ab60362
children 9a215113c84c
files FrmReplaceUnitEquipment.cs
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/FrmReplaceUnitEquipment.cs	Sat Sep 26 19:55:13 2009 +0000
+++ b/FrmReplaceUnitEquipment.cs	Mon Sep 28 19:19:34 2009 +0000
@@ -210,7 +210,7 @@
 		private void SetOkayButton()
 		{
 			double equipAmount = equipmentAmount.EquipmentAmount;
-			bttnOkay.Enabled = equipAmount > 0 || equipAmount == WarFoundryCore.INFINITY || !((UnitEquipmentItem)listItems.SelectedItem).IsRequired;
+			bttnOkay.Enabled = equipAmount > 0 || equipAmount == WarFoundryCore.INFINITY || (listItems.SelectedItem != null && !((UnitEquipmentItem) listItems.SelectedItem).IsRequired);
 		}
 
 		private void numEquipAmount_ValueChanged(object sender, System.EventArgs e)