From 08bbb827140edc6ce3a1730853093689af0ee6b9 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 18 Feb 2015 12:04:26 +0000 Subject: [PATCH] Fixes Index out of range when a Referenced Object is missing from the RO.FST. This will output an error message since it reflects an error in the plant data. --- PROMS/Volian.Print.Library/vlnParagraph.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 6b044fc0..88fb82ce 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -229,7 +229,7 @@ namespace Volian.Print.Library if (box != null) { box.Height = yoff - box.YOffset; // new height, with children - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || + if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) { if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null @@ -2758,8 +2758,14 @@ namespace Volian.Print.Library string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); string roid = subs[1]; string val = lookup.GetRoValue(subs[1]); - if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12)); - if (val != null) + if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12)); + if (val == "?") + { + erMsg = string.Format("Referenced Object does not exist."); + _MyLog.WarnFormat("Missing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath); + yoff += 2 * SixLinesPerInch; + } + else if (val != null && val != "?") { string[] vals = val.Split("\n".ToCharArray()); Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips; @@ -4221,7 +4227,7 @@ namespace Volian.Print.Library if (myTab != null) myTab.XOffset = (float)colOvrd; // set the note/caution tab offset to the colOverride return; } - // put in for Point Beach (wep2) we don't want to do this if we are processing a boxed substep (cont. action substep) + // put in for Point Beach (wep2) we don't want to do this if we are processing a boxed substep (cont. action substep) else if (bxIndx != null && (itemInfo.IsCaution || itemInfo.IsNote || !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.ContActBoxOnSubSteps)) { @@ -4275,7 +4281,7 @@ namespace Volian.Print.Library { // if the tab is 3 char or smaller, make the indent amount for the rno text 4 characters. // if bigger, make it the additional tab size. - int len = myTab.Text.Trim().Length; + int len = myTab.Text.Trim().Length; int adj = len <= 3 ? 4 : (len - 3) + 4; float rnoOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)itemInfo.MyDocStyle.CenterLineX + 5; float tPtPerChar = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6;