diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 14a26c3abc81b08e2d049364b4f08e00fc18d6bf..d8e3251d7f6db2d14c4b191882f53511af4ba194 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1277,7 +1277,10 @@ void ProjectExplorerPlugin::unloadProject()
     if (debug)
         qDebug() << "ProjectExplorerPlugin::unloadProject";
 
-    unloadProject(dd->m_currentProject);
+    QList<Project *> projects = SessionManager::projects();
+    QTC_ASSERT(!projects.isEmpty(), return);
+
+    unloadProject(projects.first());
 }
 
 void ProjectExplorerPlugin::unloadProject(Project *project)