diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index ab1611ed6..c78464f81 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -465,6 +465,11 @@ void CheckNullPointer::nullPointerError(const Token *tok, const std::string &var return; } + if (!value) { + reportError(tok, Severity::error, "nullPointer", "Null pointer dereference", CWE476, inconclusive); + return; + } + if (!_settings->isEnabled(value, inconclusive)) return;