From 57d4d9480b33908e0b727f7067554ec82d25ed51 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 13 Mar 2013 13:31:41 +0100 Subject: [PATCH] CMakeValidator: Make code more robust Change-Id: Ibfe0572adee9d5ffe98259465d5070448d704e1c Reviewed-by: Kai Koehne Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakevalidator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp index 27d38291cb2..8a85a756fa7 100644 --- a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp +++ b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp @@ -223,6 +223,8 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output) QList cmakeCommandsHelp = output.split('\n'); for (int i = 0; i < cmakeCommandsHelp.count(); ++i) { QByteArray lineTrimmed = cmakeCommandsHelp.at(i).trimmed(); + if (cmakeFunctionsList.isEmpty()) + break; if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) { QStringList commandSyntaxes; QString currentCommandSyntax; @@ -231,7 +233,7 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output) for (; i < cmakeCommandsHelp.count(); ++i) { lineTrimmed = cmakeCommandsHelp.at(i).trimmed(); - if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) { + if (!cmakeFunctionsList.isEmpty() && cmakeFunctionsList.first().toLatin1() == lineTrimmed) { //start of next function in output if (!currentCommandSyntax.isEmpty()) commandSyntaxes << currentCommandSyntax.append(QLatin1String(""));