We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d13a8d6 commit 27af3edCopy full SHA for 27af3ed
1 file changed
lib/checkstl.cpp
100644
100755
@@ -140,13 +140,12 @@ void CheckStl::iterators()
140
validIterator = true;
141
142
// Is iterator compared against different container?
143
- if (tok2->isComparisonOp() && container) {
+ if (tok2->isComparisonOp() && container && tok2->astOperand1() && tok2->astOperand2()) {
144
const Token *other = nullptr;
145
if (tok2->astOperand1()->varId() == iteratorId)
146
other = tok2->astOperand2()->tokAt(-3);
147
else if (tok2->astOperand2()->varId() == iteratorId)
148
other = tok2->astOperand1()->tokAt(-3);
149
-
150
if (Token::Match(other, "%name% . end|rend|cend|crend ( )") && other->varId() != container->declarationId())
151
iteratorsError(tok2, container->name(), other->str());
152
}
0 commit comments