From a5613715db2b221278f75ad7bb9c8baddde7240b Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 20 Oct 2016 23:20:46 +0200 Subject: [PATCH] logic: Fixed crash when Project Paths contain files and lazy include search in enabled bug id = 201 --- src/lib/utility/file/FileSystem.cpp | 2 +- src/lib_cxx/CxxProject.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/utility/file/FileSystem.cpp b/src/lib/utility/file/FileSystem.cpp index 418582bc..de3849ab 100644 --- a/src/lib/utility/file/FileSystem.cpp +++ b/src/lib/utility/file/FileSystem.cpp @@ -200,7 +200,7 @@ std::vector FileSystem::getSubDirectories(const FilePath &path) { std::vector v; - if (!path.exists()) + if (!path.exists() || !path.isDirectory()) { return v; } diff --git a/src/lib_cxx/CxxProject.cpp b/src/lib_cxx/CxxProject.cpp index 972bc3f4..dbb471fe 100644 --- a/src/lib_cxx/CxxProject.cpp +++ b/src/lib_cxx/CxxProject.cpp @@ -95,7 +95,7 @@ Parser::Arguments CxxProject::getParserArguments() const utility::append(args.compilerFlags, m_projectSettings->getCompilerFlags()); // Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files. - for (const FilePath& sourcePath: getSourcePaths()) + for (const FilePath& sourcePath : getSourcePaths()) { if (sourcePath.isDirectory()) { @@ -111,9 +111,9 @@ Parser::Arguments CxxProject::getParserArguments() const if (m_projectSettings->getUseSourcePathsForHeaderSearch()) { std::vector headerSearchSubPaths; - for (FilePath p : m_projectSettings->getSourcePaths()) + for (const FilePath& sourcePath : getSourcePaths()) { - utility::append(headerSearchSubPaths, FileSystem::getSubDirectories(p)); + utility::append(headerSearchSubPaths, FileSystem::getSubDirectories(sourcePath)); } utility::append(args.systemHeaderSearchPaths, utility::unique(headerSearchSubPaths));