B2021-087 & B2021-085: Crash on print/approval caused by null reference on no bullet printing for WCN

This commit is contained in:
Kathy Ruffing 2021-08-26 10:51:16 +00:00
parent 5d9aa3725b
commit c40f58f572

View File

@ -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);