CppEditor: Do not insert empty project part lists

... in CppModelManager::projectPart().
Amends 96c21b0e36.

Change-Id: I7e0dac258a4b4576a6ab772cb7074068a1bea726
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2023-12-05 14:16:36 +01:00
parent f52c92bfe5
commit 68e44b3372

View File

@@ -1653,7 +1653,10 @@ QList<ProjectPart::ConstPtr> CppModelManager::projectPart(const FilePath &fileNa
} }
const FilePath canonicalPath = fileName.canonicalPath(); const FilePath canonicalPath = fileName.canonicalPath();
QWriteLocker locker(&d->m_projectLock); QWriteLocker locker(&d->m_projectLock);
auto it = d->m_fileToProjectParts.insert(fileName, d->m_fileToProjectParts.value(canonicalPath)); const auto it = d->m_fileToProjectParts.constFind(canonicalPath);
if (it == d->m_fileToProjectParts.constEnd())
return {};
d->m_fileToProjectParts.insert(fileName, it.value());
return it.value(); return it.value();
} }