Commit 57d4d948 authored by Daniel Teske's avatar Daniel Teske
Browse files

CMakeValidator: Make code more robust



Change-Id: Ibfe0572adee9d5ffe98259465d5070448d704e1c
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent a6a8e235
......@@ -223,6 +223,8 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
QList<QByteArray> 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("</table>"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment