From 1476787f407ddcbfafecd70650c35566d213d0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 17 May 2013 14:10:53 +0200 Subject: [PATCH] CheckClass: Fixed nullpointer check and then dereference warning. --- lib/checkclass.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index c2a04f94c..786789d63 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -899,8 +899,11 @@ void CheckClass::noMemset() const Token* arg1 = tok->tokAt(2); const Token* arg3 = arg1; arg3 = arg3->nextArgument(); - if (arg3) - arg3 = arg3->nextArgument(); + arg3 = (arg3 != NULL) ? arg3->nextArgument() : NULL; + if (!arg3) + // weird, shouldn't happen: memset etc should have + // 3 arguments. + continue; const Token *typeTok = 0; const Scope *type = 0;