Decide what a missing value means
A null check can avoid an immediate crash but may hide a broken invariant if an object is required to exist. Ask whether absence is permitted and what the program should do when it occurs. A failed search returning null is different from an initialization failure leaving an unexpected null value. Inspect the function that creates the pointer and the route that passes it onward, not only the final dereference. The expected contract determines whether the fix belongs in error handling, construction, or state management.
Stop immediately after creation
For a function returning a pointer, inspect the result right after the call. Its register location depends on the target calling convention and return type. If it is already null, investigate construction inputs, files, permissions, or unavailable resources. If it is valid initially but null later, narrow down the code that changes it. Multiple copies, similarly named variables, and a local variable shadowing a member can make you inspect the wrong value. Identify the exact pointer consumed by the failing operation.
Follow failure through the caller
When a function intentionally returns null on failure, check how the caller handles that case. A successful lookup and an absent result should follow the intended branches. Reproduce both at the same boundary. Silently returning an empty result may prevent a crash while making later work appear successful. Confirm whether the failure should reach the user, be retried, or be returned to another function. The behavior after the check matters as much as the check itself.
A non-null pointer is not automatically valid
A freed object or an uninitialized pointer can have a nonzero address. Null checks do not establish lifetime. Compare the period when the owner keeps the object alive with the period when callbacks or asynchronous jobs use it. A function can return before a stored address is consumed. Distinguish a genuinely absent object from an object whose lifetime ended; the corrective rules are different. Test deliberate construction failures as well as normal paths.
Exercise the missing-result case
For a lookup function, choose one existing item and one nonexistent item. Confirm that the missing result produces the designed message or error rather than reusing an earlier selection or announcing success. This small comparison helps decide which boundary needs validation and prevents scattered checks from concealing an unclear contract.