CWE-395—Use of NullPointerException Catch to Detect NULL Pointer Dereference
PUBLISHEDweakness record
released 2006-07-19 · last modified 2025-12-11
Metadata
Weakness Name
Use of NullPointerException Catch to Detect NULL Pointer Dereference
Description
Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.
Programmers typically catch NullPointerException under three circumstances: Of these three circumstances, only the last is acceptable.