From ae9a5807b83ebfffc0c882b514c021729d34ddf2 Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@stfc.ac.uk>
Date: Fri, 2 Oct 2015 14:54:10 +0100
Subject: [PATCH] Check if we do indeed have an exit button defined.

Refs #13836
---
 Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp b/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp
index 5299ae1d042..872eb36f14b 100644
--- a/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp
+++ b/Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp
@@ -1191,16 +1191,17 @@ void AlgorithmDialog::errorHandle(const IAlgorithm *alg, const std::string &what
  * Only allow close when close is enabled
  */
 void AlgorithmDialog::closeEvent(QCloseEvent *evt) {
-  if(m_exitButton->isEnabled()) {
-    evt->accept();
-  }
-  else {
-    evt->ignore();
+  if (m_exitButton) {
+    if (m_exitButton->isEnabled()) {
+      evt->accept();
+    } else {
+      evt->ignore();
+    }
+  } else {
+    QDialog::closeEvent(evt);
   }
 }
 
-
-
 /**Handle completion of algorithm started while staying open.
  * reenables the OK button when the algorithms finishes.
  *
-- 
GitLab