diff --git a/lib/pathanalysis.cpp b/lib/pathanalysis.cpp index f70681372..85431f4f4 100644 --- a/lib/pathanalysis.cpp +++ b/lib/pathanalysis.cpp @@ -85,7 +85,7 @@ PathAnalysis::Progress PathAnalysis::forwardRecursive(const Token* tok, Info inf PathAnalysis::Progress PathAnalysis::forwardRange(const Token* startToken, const Token* endToken, Info info, const std::function& f) const { - for (const Token *tok = startToken; tok && tok != endToken; tok = tok->next()) { + for (const Token *tok = startToken; precedes(tok, endToken); tok = tok->next()) { if (Token::Match(tok, "asm|goto|break|continue")) return Progress::Break; else if (Token::Match(tok, "return|throw")) {