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

@@ -4138,7 +4138,7 @@ namespace VEPROMS.CSLA.Library
bool isAlpha = tbformat.ToUpper().Contains("ALPHA");
int ordinal = Ordinal;
bool useLinked = false; // if this is enhanced, and the LinkedTab isn't numeric, flag to use 'LinkedTab' for the tab.
if (MyActiveSection.IsEnhancedSection)
if (ActiveSection != null && ActiveSection.IsEnhancedSection) // C2018-003 fixed use of getting the active section
{
if (IsEnhancedStep)
try
@@ -4332,8 +4332,9 @@ namespace VEPROMS.CSLA.Library
newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1);
}
// also see if there is the 'pagelist' string in this tab:
// C2018-003 fixed use of getting the active section
else if ((FormatStepData.TabData.Font.Style & E_Style.Underline) == E_Style.Underline &&
((MyActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) != E_DocStructStyle.DSS_PageListSpBckgrnd))
ActiveSection != null && ((ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) != E_DocStructStyle.DSS_PageListSpBckgrnd))
// the reason that the underline commands were not included in format file is that the '\' character
// is used as a separator and the following code will not impact other formats
HighLevelStepTabPageList = @"\ul " + FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat;
@@ -4485,7 +4486,7 @@ namespace VEPROMS.CSLA.Library
public int CurrentSectionLevel()
{
int countlev = 0;
if ((MyActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.DSS_TreatAsTrueSectNum) != 0)
if (ActiveSection != null && (ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.DSS_TreatAsTrueSectNum) != 0) // C2018-003 fixed use of getting the active section
{
ItemInfo ii = ActiveSection.MyParent;
while (!ii.IsProcedure)