CWE-395

Use of NullPointerException Catch to Detect NULL Pointer Dereference

Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.

Mitigation

Phases: Architecture and Design, Implementation

Description:

  • Do not extensively rely on catching exceptions (especially for validating user input) to handle errors. Handling exceptions can decrease the performance of an application.

No CAPEC attack patterns related to this CWE.

Back to CWE stats page