diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp
index d03c68bab7fcac426da7d91a3dbda0630e212fe3..6c307af0c5a16c7860d75c717c92929f5832aa0f 100644
--- a/src/plugins/debugger/cdb/cdbdebugengine.cpp
+++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp
@@ -824,7 +824,7 @@ void CdbDebugEnginePrivate::processCreatedAttached(ULONG64 processHandle, ULONG6
 void CdbDebugEngine::processTerminated(unsigned long exitCode)
 {
     manager()->showDebuggerOutput(LogMisc, tr("The process exited with exit code %1.").arg(exitCode));
-    if (m_engine->state() != InferiorStopping)
+    if (state() != InferiorStopping)
         setState(InferiorStopping, Q_FUNC_INFO, __LINE__);
     setState(InferiorStopped, Q_FUNC_INFO, __LINE__);
     setState(InferiorShuttingDown, Q_FUNC_INFO, __LINE__);