diff --git a/src/checkother.h b/src/checkother.h index b779fa38f..6f9cd9e9b 100644 --- a/src/checkother.h +++ b/src/checkother.h @@ -47,12 +47,12 @@ public: { CheckOther checkOther(tokenizer, settings, errorLogger); + checkOther.nullPointer(); if (settings->_checkCodingStyle) { checkOther.warningOldStylePointerCast(); checkOther.checkUnsignedDivision(); checkOther.checkCharVariable(); - checkOther.nullPointer(); } } diff --git a/test/testother.cpp b/test/testother.cpp index 82c0b1511..92023d475 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -774,6 +774,15 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + checkNullPointer("void foo(P *p)\n" + "{\n" + " while (p)\n" + " if (p->check())\n" + " break;\n" + " else\n" + " p = p->next();\n" + "}\n"); + TODO_ASSERT_EQUALS("", errout.str()); }