Fix crash in isSameExpression (#2748)
This commit is contained in:
parent
33fb0e782e
commit
becdf20310
|
@ -795,6 +795,8 @@ bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2
|
||||||
const Token *lhs = tok1->previous();
|
const Token *lhs = tok1->previous();
|
||||||
while (Token::Match(lhs, "(|.|["))
|
while (Token::Match(lhs, "(|.|["))
|
||||||
lhs = lhs->astOperand1();
|
lhs = lhs->astOperand1();
|
||||||
|
if (!lhs)
|
||||||
|
return false;
|
||||||
const bool lhsIsConst = (lhs->variable() && lhs->variable()->isConst()) ||
|
const bool lhsIsConst = (lhs->variable() && lhs->variable()->isConst()) ||
|
||||||
(lhs->valueType() && lhs->valueType()->constness > 0) ||
|
(lhs->valueType() && lhs->valueType()->constness > 0) ||
|
||||||
(Token::Match(lhs, "%var% . %name% (") && library.isFunctionConst(lhs->tokAt(2)));
|
(Token::Match(lhs, "%var% . %name% (") && library.isFunctionConst(lhs->tokAt(2)));
|
||||||
|
|
Loading…
Reference in New Issue