From 9657619153daf8cfcf1746120befc485288c513f Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 29 Jan 2019 15:34:13 +0000 Subject: [PATCH] =?UTF-8?q?B2019-013:=20Fix=20crash=20when=20getting=20sec?= =?UTF-8?q?tion=20properties=20if=20section=E2=80=99s=20format=20had=20UCF?= =?UTF-8?q?=20checkoffs=20but=20none=20in=20its=20derived=20from=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frmSectionProperties.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index a35db2d7..8f5048be 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -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(); // 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;