Skip to content

Commit 0e9fc7d

Browse files
Update checknullpointer.cpp
1 parent ae060de commit 0e9fc7d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/checknullpointer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ void CheckNullPointer::nullPointerByDeRefAndCheck()
310310

311311
return true;
312312
};
313-
std::vector<const Token *> tokens = findTokensSkipDeadAndUnevaluatedCode(mSettings->library, scope->bodyStart, scope->bodyEnd, pred);
313+
const Token* const start = scope->function->isConstructor() ? scope->function->token : scope->bodyStart; // Check initialization list
314+
std::vector<const Token *> tokens = findTokensSkipDeadAndUnevaluatedCode(mSettings->library, start, scope->bodyEnd, pred);
314315
for (const Token *tok : tokens) {
315316
const ValueFlow::Value *value = tok->getValue(0);
316317

0 commit comments

Comments
 (0)