diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 917abff9..e416c521 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -1162,14 +1162,23 @@ namespace VEPROMS // B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well // trap for this and close only the Word tab in PROMS // B2017-214 added a null reference check - if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null) + if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null && tc._MyDisplayTabItems.Count > 0) { string stk = Volian.Base.Library.vlnStackTrace.StackToString(); if (!stk.Contains("MouseUp") && !stk.Contains("ButtonDown") && !stk.Contains("Exception")) { - e.Cancel = true; - tc.CloseTabItem(tc.SelectedDisplayTabItem); - return; + // B2018-091 Allow PROMS to close if only MSWord sections have been opened. + int n = tc._MyDisplayTabItems.Count; + while (n-- > 0 && tc._MyDisplayTabItems.Count > 0) + { + tc.CloseTabItem(tc.SelectedDisplayTabItem); + } + if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null && tc._MyDisplayTabItems.Count > 0) + { + _MyLog.WarnFormat(string.Format("Stack Does not contain a MouseUp, a ButtonDown, an Exception\r\n" + + "PROMS will Not Exit. Stack : \r\n{0}", stk)); + e.Cancel = true; // If Display Items still exist don't close. + } } } //C2015-022 Separate Windows - if child windows are open and we are closing the main PROMS window, give user a chance to not close PROMS and that child windows @@ -1846,7 +1855,7 @@ namespace VEPROMS if(id != "") { ItemInfo ii = GetItemInfoFromString(id); - if (!dicProcs.ContainsKey(ii.MyProcedure.ItemID)) + if (ii != null && !dicProcs.ContainsKey(ii.MyProcedure.ItemID))// B2018-087 - Don't fail if it doesn't exist dicProcs.Add(ii.MyProcedure.ItemID, ii.MyProcedure); } }