B2019-013: Fix crash when getting section properties if section’s format had UCF checkoffs but none in its derived from format

This commit is contained in:
Kathy Ruffing 2019-01-29 15:34:13 +00:00
parent e77ff7c98e
commit 9657619153

View File

@ -706,20 +706,32 @@ namespace VEPROMS
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
int maxindx = pf.FormatData.ProcData.CheckOffUCF ? pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndex : pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
// B2019-013: was crashing on indexer of checkofflist. If there were UCF checkoffs but none in original format, the indexer
// was failing for index of 0 (indexer code went through index attribute of xml and was returning null even though there
// were items in list).
_hasSectionCheckoffDefault = false;
if (chkoffList != null)
{
foreach (CheckOff co in chkoffList)
{
if (co.MenuItem.ToUpper().Equals("{SECTION DEFAULT}"))
{
_hasSectionCheckoffDefault = true;
break;
}
}
}
if (chkoffList != null && maxindx > 0 &&
(pf.FormatData.ProcData.CheckOffData.Menu == "Signoff" || chkoffList[0].MenuItem.ToUpper().Equals("{SECTION DEFAULT}")))
(pf.FormatData.ProcData.CheckOffData.Menu == "Signoff") || _hasSectionCheckoffDefault)
{
if (SectionPropertyCheckOffList!=null)SectionPropertyCheckOffList.Clear();
SectionPropertyCheckOffList = new List<CheckOff>();
// Don't put up the first item in the chkoffList, it is '{Section Default}'.
_hasSectionCheckoffDefault = false;
//for (int i = 1; i < chkoffList.Count; i++)
foreach (CheckOff co in chkoffList)
{
if (!co.MenuItem.ToUpper().Equals("{SECTION DEFAULT}"))
SectionPropertyCheckOffList.Add(co);
else
_hasSectionCheckoffDefault = true;
}
ppGpbxSignoffCheckoff.Enabled = true;
ppCmbxCheckoffType.DataSource = SectionPropertyCheckOffList;