C2018-003 corrected use of MyActiveSection vs ActiveSection and added NULL checks

This commit is contained in:
2018-10-08 15:30:05 +00:00
parent b1e6d50716
commit 37fb880794
7 changed files with 85 additions and 73 deletions

View File

@@ -798,9 +798,9 @@ namespace Volian.Print.Library
}
}
string stepnum = "";
string sectitle = itm.ActiveSection.DisplayText;
string sectitle = (itm.ActiveSection != null) ? itm.ActiveSection.DisplayText : "";
if (itm.IsSection)
stepnum = itm.MyActiveSection.DisplayNumber;
stepnum = (itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : "";
else
stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1);
AddCell(rotable, stepnum, f2, Color.WHITE);
@@ -1043,7 +1043,7 @@ namespace Volian.Print.Library
iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK);
foreach (ItemInfo itm in sortedStepList.Values)
{
string stepnum = (itm.IsSection)? itm.MyActiveSection.DisplayNumber:stepnum = BuildStepTab(itm);
string stepnum = (itm.IsSection && itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : stepnum = BuildStepTab(itm);// C2018-003 fixed use of getting the active section
AddCell(rotable, stepnum, f2, Color.WHITE);
AddCell(rotable, itm.DisplayText, f2, Color.WHITE);
}
@@ -1098,7 +1098,7 @@ namespace Volian.Print.Library
rotable.AddCell(ProcTitleCell); // put RO value and description
lastProcKey = procKey;
}
string stepnum = (itm.IsSection)?itm.MyActiveSection.DisplayNumber:BuildStepTab(itm);
string stepnum = (itm.IsSection && itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : BuildStepTab(itm);// C2018-003 fixed use of getting the active section
string itemkey = stepnum + " " + itm.ItemID.ToString(); // add ItemId to stepnum, sometimes we have idential stepnum text for different steps (ex: blank section numbers)
if (!sortedStepList.ContainsKey(itemkey))
sortedStepList.Add(itemkey, itm);