Skip to content

Commit 266cfda

Browse files
authored
CheckStl: granulized some checks in checkIteratorPair() to bail out early (danmar#7133)
1 parent 32a37f4 commit 266cfda

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/checkstl.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,12 @@ bool CheckStl::checkIteratorPair(const Token* tok1, const Token* tok2)
799799
return false;
800800
}
801801
const Token* iter1 = getIteratorExpression(tok1);
802+
if (!iter1)
803+
return false;
802804
const Token* iter2 = getIteratorExpression(tok2);
803-
if (iter1 && iter2 && !isSameIteratorContainerExpression(iter1, iter2, *mSettings)) {
805+
if (!iter2)
806+
return false;
807+
if (!isSameIteratorContainerExpression(iter1, iter2, *mSettings)) {
804808
mismatchingContainerExpressionError(iter1, iter2);
805809
return true;
806810
}

0 commit comments

Comments
 (0)