Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 406 Bytes

unnecessary_null_checks.md

File metadata and controls

32 lines (22 loc) · 406 Bytes

Pattern: Unnecessary null check

Issue: -

Description

Don't apply a null check when a nullable value is accepted.

Example of incorrect code:

f(int? i);
m() {
 int? j;
 f(j!);
}

Example of correct code:

f(int? i);
m() {
 int? j;
 f(j);
}

Further Reading