Remove unnecessary null check (#3215)
Spotted by coverity (as the condition in the `if` part `isArrayVar(tok)` dereferences tok. Tok can't be null here, because the condition in the `else if`on line 268 checks that there is a `%var%` following, and `tok = Token::findmatch(tok->next(), "%var%");` simply gets this `%var%` token.
This commit is contained in:
parent
d2184ac6a8
commit
9aa131a12e
|
@ -270,7 +270,7 @@ void CheckAutoVariables::autoVariables()
|
|||
tok = Token::findmatch(tok->next(), "%var%");
|
||||
if (isArrayVar(tok))
|
||||
errorInvalidDeallocation(tok, nullptr);
|
||||
else if (tok && tok->variable() && tok->variable()->isPointer()) {
|
||||
else if (tok->variable() && tok->variable()->isPointer()) {
|
||||
for (const ValueFlow::Value &v : tok->values()) {
|
||||
if (!(v.isTokValue()))
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue