From 8b864b3d447f22ecd68f8bdec12f1c437494446b Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Mar 2018 14:33:20 +0000 Subject: [PATCH] Improved logic for bug fix B2018-043. Added a NULL reference check in the logic that detects an infinite loop while checking for invalid transitions --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 35ce5f77..7fb40f96 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -743,16 +743,19 @@ namespace VEPROMS.CSLA.Library { bool hasAnnotation = false; AnnotationType myType = AnnotationType.GetByNameOrCreate("Link Converted To Text"); - foreach (AnnotationInfo anot in itemInfo.ItemAnnotations) + if (itemInfo.ItemAnnotations != null) { - if (anot.TypeID == myType.TypeID && anot.SearchText == "Invalid Transition Format") - hasAnnotation = true; - } - if (!hasAnnotation) - { - using (Item myItem = itemInfo.Get()) + foreach (AnnotationInfo anot in itemInfo.ItemAnnotations) { - Annotation.MakeAnnotation(myItem, myType, "", "Invalid Transition Format", null); + if (anot.TypeID == myType.TypeID && anot.SearchText == "Invalid Transition Format") + hasAnnotation = true; + } + if (!hasAnnotation) + { + using (Item myItem = itemInfo.Get()) + { + Annotation.MakeAnnotation(myItem, myType, "", "Invalid Transition Format", null); + } } } break;