From 65426a69ce9b1156016342e57081ce52edb58055 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 May 2011 17:45:07 +0200 Subject: [PATCH] Maemo: Fix possible crash when removing a Maemo target. If there are no packaging files for whatever reason, we try to access the first element of an empty list. Reviewed-by: dt --- .../qt4projectmanager/qt-maemo/qt4maemotarget.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp index 9a2037910b..03674d1060 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp @@ -302,13 +302,15 @@ void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *ta if (answer == QMessageBox::No) return; const QStringList pkgFilePaths = packagingFilePaths(); - project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType, - pkgFilePaths); - Core::IVersionControl * const vcs = core->vcsManager() - ->findVersionControlForDirectory(QFileInfo(packagingFilePaths().first()).dir().path()); - if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) { - foreach (const QString &filePath, pkgFilePaths) - vcs->vcsDelete(filePath); + if (!pkgFilePaths.isEmpty()) { + project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType, + pkgFilePaths); + Core::IVersionControl * const vcs = core->vcsManager() + ->findVersionControlForDirectory(QFileInfo(pkgFilePaths.first()).dir().path()); + if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) { + foreach (const QString &filePath, pkgFilePaths) + vcs->vcsDelete(filePath); + } } removeTarget(); QString error; -- 2.11.0