Commit 65426a69 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

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
parent e0993f4e
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment