Synopsis: | Method call on object which may be null |
Language: | Java |
Severity Level: | 1 |
Category: | Basic |
Description: |
The null check is broken since it will throw a Nullpointer itself.
The reason is that a method is called on the object when it is null.
It is likely that you used || instead of && or vice versa.class Foo { String munge(String string) { // should be && if (string!=null || !string.equals("")) return string; // should be || if (string==null && string.equals("")) return string; } } |