Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Fix #1…
Browse files Browse the repository at this point in the history
…1311 Do not search for null pointer in dead code
  • Loading branch information
francois-berder committed Jun 1, 2024
1 parent 13b2cab commit 1e36c26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/checknullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,15 @@ const Token * CheckNullPointer::nullPointerByDeRefAndCheck(const Token *start, c
}
} else if (Token::simpleMatch(tok, "?") && Token::simpleMatch(tok->astOperand2(), ":")) { // ternary operator
const Token *condTok = tok->astOperand1();
const Token *colonTok = tok->astOperand2();

if (condTok->hasKnownIntValue() && !condTok->getKnownIntValue()) {
/* Skip true branch */
tok = tok->astOperand2();
tok = colonTok;
} else {
/* Analyze true branch and skip the other branch */
nullPointerByDeRefAndCheck(tok->next(), colonTok, printInconclusive);
tok = nextAfterAstRightmostLeaf(colonTok);
}
} else {
if (isUnevaluated(tok)) {
Expand Down

0 comments on commit 1e36c26

Please sign in to comment.