From 47950597033c24ae4d784e63c7204b7e36ab6443 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 16 Feb 2016 16:01:26 +0100 Subject: CppTools: Avoid inserting invalid entries into cache ...of resolved files. This is an issue when first a misconfigured project (missing include paths) is indexed. E.g. then resolves to "", which is inserted into the cache. Resolving the same header for subsequent projects has returned the empty string although their header paths were correct. This led to wrong includes of documents from the global snapshot. Task-number: QTCREATORBUG-15736 Change-Id: Ia3e3a06775a50dd75bc62a46d674c7b46a1c5965 Reviewed-by: Christian Stenger Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cppsourceprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cppsourceprocessor.cpp') diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp index c5376b9b96..390380e677 100644 --- a/src/plugins/cpptools/cppsourceprocessor.cpp +++ b/src/plugins/cpptools/cppsourceprocessor.cpp @@ -245,7 +245,8 @@ QString CppSourceProcessor::resolveFile(const QString &fileName, IncludeType typ if (it != m_fileNameCache.constEnd()) return it.value(); const QString fn = resolveFile_helper(fileName, type); - m_fileNameCache.insert(fileName, fn); + if (!fn.isEmpty()) + m_fileNameCache.insert(fileName, fn); return fn; } -- cgit v1.2.1