From 8a4b0aeabfda60477c6b5b942bb4345518142d3f Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 4 Apr 2017 16:20:38 +0300 Subject: [PATCH] Debugger: Fix crash on shutdown If the application fails to start (like an empty exe file), the debugger remains in "active" state, and it crashes on shutdown. Change-Id: I6ae3a98d507856ea40375edb15c9ea4605e3efc6 Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4223065c145..b71d8c72771 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1914,12 +1914,13 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project) for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) { // Run controls might be deleted during exit. if (DebuggerEngine *engine = m_snapshotHandler->at(i)) { - DebuggerRunControl *runControl = engine->runControl(); - RunConfiguration *rc = runControl->runConfiguration(); - if (rc == activeRc) { - m_snapshotHandler->setCurrentIndex(i); - updateState(engine); - return; + if (DebuggerRunControl *runControl = engine->runControl()) { + RunConfiguration *rc = runControl->runConfiguration(); + if (rc == activeRc) { + m_snapshotHandler->setCurrentIndex(i); + updateState(engine); + return; + } } } }