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 diff
     1.1 --- a/FrmReplaceUnitEquipment.cs	Sat Sep 26 19:55:13 2009 +0000
     1.2 +++ b/FrmReplaceUnitEquipment.cs	Mon Sep 28 19:19:34 2009 +0000
     1.3 @@ -210,7 +210,7 @@
     1.4  		private void SetOkayButton()
     1.5  		{
     1.6  			double equipAmount = equipmentAmount.EquipmentAmount;
     1.7 -			bttnOkay.Enabled = equipAmount > 0 || equipAmount == WarFoundryCore.INFINITY || !((UnitEquipmentItem)listItems.SelectedItem).IsRequired;
     1.8 +			bttnOkay.Enabled = equipAmount > 0 || equipAmount == WarFoundryCore.INFINITY || (listItems.SelectedItem != null && !((UnitEquipmentItem) listItems.SelectedItem).IsRequired);
     1.9  		}
    1.10  
    1.11  		private void numEquipAmount_ValueChanged(object sender, System.EventArgs e)