forked from qt-creator/qt-creator
Fix crash on renaming files in generic project manager
Task-number: QTCREATORBUG-8638 Change-Id: Ie5b9c237459f4e6d503121331a51821cd812bee8 Reviewed-by: Matthias Blaicher <matthias@blaicher.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -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)
|
|||||||
|
|
||||||
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
|
|||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user