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

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)
QString baseDir = QFileInfo(path()).absolutePath();
QHash<QString, QStringList> filesInPaths = sortFilesIntoPaths(baseDir, added);
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());
if (!folder)
folder = createFolderByName(components, components.size());
......@@ -136,7 +138,9 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
filesInPaths = sortFilesIntoPaths(baseDir, removed);
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());
QList<FileNode *> fileNodes;
......@@ -176,9 +180,6 @@ FolderNode *GenericProjectNode::createFolderByName(const QStringList &components
const QString component = components.at(end - 1);
if (component.isEmpty())
return this;
const QString baseDir = QFileInfo(path()).path();
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
folder->setDisplayName(component);
......
Markdown is supported
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