Synopsis: | The null check here is misplaced; if the variable is null there'll be a NullPointerException |
Language: | Java |
Severity Level: | 1 |
Category: | Basic |
Description: |
The null check here is misplaced. if the variable is null you'll get a NullPointerException.
Either the check is useless (the variable will never be "null") or it's incorrect.public class Foo { void bar() { if (a.equals(baz) || a == null) {} } } Justification: If the variable is null, a NullPointerException is triggered when equals method is called. |