summaryrefslogtreecommitdiff
path: root/src/qdoc/clangcodeparser.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2017-11-14 14:18:18 +0100
committerTopi Reiniƶ <topi.reinio@qt.io>2017-11-14 13:35:20 +0000
commit20ebbeb2a69dbe646a0d8dea347bab4a6adf1701 (patch)
tree6038f4a14d2f97159bbbb4caf937581de2d6f40f /src/qdoc/clangcodeparser.cpp
parent2f6aaed6dc157121e95b5dd210aea8bbd1338722 (diff)
downloadqttools-20ebbeb2a69dbe646a0d8dea347bab4a6adf1701.tar.gz
qdoc: Fix crash on ClangCodeParser::getMoreArgs()
ASSERT failure in QList<T>::at: "index out of range" for documentation modules that do not have any headers. Change-Id: Ia8bc776d9c48c34b962356a65f74b2c7fe1d2d8c Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r--src/qdoc/clangcodeparser.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 44da9d7ed..e6c6d5801 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1057,14 +1057,15 @@ void ClangCodeParser::getMoreArgs()
that list instead.
*/
QList<QString> headers = allHeaders_.values();
- QString filePath = headers.at(0);
auto forest = qdb_->searchOrder();
QByteArray version = qdb_->version().toUtf8();
QString basicIncludeDir = QDir::cleanPath(QString(Config::installDir + "/../include"));
moreArgs_ += "-I" + basicIncludeDir.toLatin1();
- moreArgs_ += "-I" + QDir::cleanPath(QString(filePath + "/../")).toLatin1();
- moreArgs_ += "-I" + QDir::cleanPath(QString(filePath + "/../../")).toLatin1();
+ if (!headers.isEmpty()) {
+ moreArgs_ += "-I" + QDir::cleanPath(QString(headers.at(0) + "/../")).toLatin1();
+ moreArgs_ += "-I" + QDir::cleanPath(QString(headers.at(0) + "/../../")).toLatin1();
+ }
for (const auto &s : forest) {
QString module = basicIncludeDir +"/" + s->camelCaseModuleName();
moreArgs_ += QString("-I" + module).toLatin1();