Overview
- Bug Type:
- Null dereference
- Category:
- Error Handling & Input Validation
Definition
Code accesses a null/undefined reference and crashes or throws.
How to fix Null dereference?
Add preconditions/guards; use non-null types and optional chaining where safe; validate inputs; test absent cases
Symptoms
Observable signs that may indicate Null dereference:
- Crashes or exceptions when accessing properties on null/undefined.
- Intermittent failures depending on optional inputs.
- Hot path guarded only in some code paths.
Example Errors:
- TypeError: Cannot read properties of null
- NullReferenceException
- Segmentation fault on null pointer
