forked from qt-creator/qt-creator
CMakeValidator: Make code more robust
Change-Id: Ibfe0572adee9d5ffe98259465d5070448d704e1c Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -223,6 +223,8 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
|
|||||||
QList<QByteArray> cmakeCommandsHelp = output.split('\n');
|
QList<QByteArray> cmakeCommandsHelp = output.split('\n');
|
||||||
for (int i = 0; i < cmakeCommandsHelp.count(); ++i) {
|
for (int i = 0; i < cmakeCommandsHelp.count(); ++i) {
|
||||||
QByteArray lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
|
QByteArray lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
|
||||||
|
if (cmakeFunctionsList.isEmpty())
|
||||||
|
break;
|
||||||
if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
|
if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
|
||||||
QStringList commandSyntaxes;
|
QStringList commandSyntaxes;
|
||||||
QString currentCommandSyntax;
|
QString currentCommandSyntax;
|
||||||
@@ -231,7 +233,7 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
|
|||||||
for (; i < cmakeCommandsHelp.count(); ++i) {
|
for (; i < cmakeCommandsHelp.count(); ++i) {
|
||||||
lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
|
lineTrimmed = cmakeCommandsHelp.at(i).trimmed();
|
||||||
|
|
||||||
if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
|
if (!cmakeFunctionsList.isEmpty() && cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
|
||||||
//start of next function in output
|
//start of next function in output
|
||||||
if (!currentCommandSyntax.isEmpty())
|
if (!currentCommandSyntax.isEmpty())
|
||||||
commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
|
commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
|
||||||
|
|||||||
Reference in New Issue
Block a user