diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 915311b8..aa9da23c 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -1124,10 +1124,15 @@ namespace Volian.Controls.Library _ItemInfo = lbSrchResults.SelectedValue as ItemInfo; if ((tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) && (_ItemInfo != null)) { - _AnnotationDetails.CurrentAnnotation = AnnotationInfo.Get(_ItemInfo.SearchAnnotationID); - if (_AnnotationDetails.CurrentAnnotation != null) - _TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text - _AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid + // B2020-019: Don't set the CurrentAnnotation to an annotation in a procedure that cannot be opened. + AnnotationInfo tmpca = AnnotationInfo.Get(_ItemInfo.SearchAnnotationID); + DisplayTabItem dti = null; + if (tmpca != null) dti = _TabControl.OpenItem(tmpca.MyItem); // open the corresponding procedure text + if (dti != null) + { + _AnnotationDetails.CurrentAnnotation = tmpca; + _AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid + } } else {