diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index ed05adc8..cd6ba5b9 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -820,16 +820,15 @@ namespace VEPROMS.CSLA.Library int indx = rtbString.IndexOf('-'); while (indx > -1) { - if (indx > 2) + // B2017-265 - Make sure that the location is at least 2 if checking the previous three charracters. + // This occurs when pasting from MSWord + if (indx < 2 || rtbString[indx - 1] != 'i' || rtbString[indx - 2] != 'f' || rtbString[indx - 3] != '\\') { - if (rtbString[indx - 1] != 'i' || rtbString[indx - 2] != 'f' || rtbString[indx - 3] != '\\') - { - rtbString = rtbString.Remove(indx, 1); - rtbString = rtbString.Insert(indx, @"\u8209?"); - } - if (indx + 1 > rtbString.Length) indx = -1; - else indx = rtbString.IndexOf('-', indx+1); + rtbString = rtbString.Remove(indx, 1); + rtbString = rtbString.Insert(indx, @"\u8209?"); } + if (indx + 1 > rtbString.Length) indx = -1; + else indx = rtbString.IndexOf('-', indx + 1); } return Save(rtbString); }