Even better, use compile_assert P4021 proposed to C++ - it will stop the build, there will be no bug in production code. This is a zero runtime cost, it is 100% at compile time with Clang, GCC, MSVC supported.
void foo(int* p)
{
compile_assert(nullptr!=p, “Argument must not be null”);
// your code
}