diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 3ca0df1f9..dc9b6c99f 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -1073,7 +1073,7 @@ void TokenList::validateAst() // check for endless recursion const Token* parent=tok; - while ((parent = parent->astParent())) { + while ((parent = parent->astParent()) != nullptr) { if (parent==tok) throw InternalError(tok, "AST broken: endless recursion from '" + tok->str() + "'", InternalError::SYNTAX); }