diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 88427c9c..f76976c7 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -2733,11 +2733,21 @@ namespace Volian.Print.Library // F2020-023: tab includes parent tab and if caution/note don't use its parent, go up another level string noBullet = MyItemInfo.IsCautionOrNotePart ? MyItemInfo.MyParent.MyParent.CombinedTab : MyItemInfo.MyParent.CombinedTab; // C2021-024: WCN1 if bullet exists in combined tab, stop right before bullet. + // B2021-085 & 087: crash if noBullet was null. Also, if null, see if text in parent. if no text, replace the + // "%s." with noBullet (null) which won't put out just a '.' as step number. if (docstyle.Continue.Top.RemoveBullet) { - int ind = noBullet.IndexOf(".o"); - if (ind < 0) ind = noBullet.IndexOf(".*"); - if (ind > -1) noBullet = noBullet.Substring(0, ind); + if (noBullet == null && MyItemInfo.IsCautionOrNotePart) noBullet = MyItemInfo.MyParent.CombinedTab; + if (noBullet != null) + { + int ind = noBullet.IndexOf(".o"); + if (ind < 0) ind = noBullet.IndexOf(".*"); + if (ind > -1) noBullet = noBullet.Substring(0, ind); + } + else + { + myMsg = myMsg.Replace(@"%s.", noBullet); + } } myMsg = myMsg.Replace(@"%s", noBullet); } @@ -3054,11 +3064,21 @@ namespace Volian.Print.Library { tmp = MyItemInfo.IsCautionOrNotePart ? MyItemInfo.MyParent.MyParent.CombinedTab : MyItemInfo.MyParent.CombinedTab; // C2021-024: WCN1 if bullet exists in combined tab, stop right before bullet. + // B2021-085 & 087: crash if noBullet was null. Also, if null, see if text in parent. if no text, replace the + // "%s." with noBullet (null) which won't put out just a '.' as step number. if (MyItemInfo.MyDocStyle.Continue.Top.RemoveBullet) { - int ind = tmp.IndexOf(".o"); - if (ind < 0) ind = tmp.IndexOf(".*"); - if (ind > -1) tmp = tmp.Substring(0, ind); + if (tmp == null && MyItemInfo.IsCautionOrNotePart) tmp = MyItemInfo.MyParent.CombinedTab; + if (tmp != null) + { + int ind = tmp.IndexOf(".o"); + if (ind < 0) ind = tmp.IndexOf(".*"); + if (ind > -1) tmp = tmp.Substring(0, ind); + } + else + { + myMsg = myMsg.Replace(@"%s.", tmp); + } } } myMsg = myMsg.Replace(@"%s", tmp);