Commit 35457f6f authored by Daniel Teske's avatar Daniel Teske
Browse files

Fix crash on renaming files in generic project manager



Task-number: QTCREATORBUG-8638

Change-Id: Ie5b9c237459f4e6d503121331a51821cd812bee8
Reviewed-by: default avatarMatthias Blaicher <matthias@blaicher.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2970a036
...@@ -119,7 +119,9 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList) ...@@ -119,7 +119,9 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QString baseDir = QFileInfo(path()).absolutePath(); QString baseDir = QFileInfo(path()).absolutePath();
QHash<QString, QStringList> filesInPaths = sortFilesIntoPaths(baseDir, added); QHash<QString, QStringList> filesInPaths = sortFilesIntoPaths(baseDir, added);
foreach (const QString &filePath, filesInPaths.keys()) { foreach (const QString &filePath, filesInPaths.keys()) {
QStringList components = filePath.split(QLatin1Char('/')); QStringList components;
if (!filePath.isEmpty())
components = filePath.split(QLatin1Char('/'));
FolderNode *folder = findFolderByName(components, components.size()); FolderNode *folder = findFolderByName(components, components.size());
if (!folder) if (!folder)
folder = createFolderByName(components, components.size()); folder = createFolderByName(components, components.size());
...@@ -136,7 +138,9 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList) ...@@ -136,7 +138,9 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
filesInPaths = sortFilesIntoPaths(baseDir, removed); filesInPaths = sortFilesIntoPaths(baseDir, removed);
foreach (const QString &filePath, filesInPaths.keys()) { foreach (const QString &filePath, filesInPaths.keys()) {
QStringList components = filePath.split(QLatin1Char('/')); QStringList components;
if (!filePath.isEmpty())
components = filePath.split(QLatin1Char('/'));
FolderNode *folder = findFolderByName(components, components.size()); FolderNode *folder = findFolderByName(components, components.size());
QList<FileNode *> fileNodes; QList<FileNode *> fileNodes;
...@@ -176,9 +180,6 @@ FolderNode *GenericProjectNode::createFolderByName(const QStringList &components ...@@ -176,9 +180,6 @@ FolderNode *GenericProjectNode::createFolderByName(const QStringList &components
const QString component = components.at(end - 1); const QString component = components.at(end - 1);
if (component.isEmpty())
return this;
const QString baseDir = QFileInfo(path()).path(); const QString baseDir = QFileInfo(path()).path();
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
folder->setDisplayName(component); folder->setDisplayName(component);
......
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