From cf58644b078f05738dbf565b245b3bb5065e6d6b Mon Sep 17 00:00:00 2001
From: Daniel Teske <daniel.teske@theqtcompany.com>
Date: Mon, 1 Dec 2014 18:31:49 +0100
Subject: [PATCH] Fix crash on unloading project

This code path is taken if there's only one project open.

Task-number: QTCREATORBUG-13569
Change-Id: If39c451b8d471df4a178610e986c9f35703746a7
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
---
 src/plugins/projectexplorer/projectexplorer.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 14a26c3abc8..d8e3251d7f6 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)
-- 
GitLab