Closed Bug 1081599 Opened 5 years ago Closed 5 years ago

Don't check for null before an instanceof

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 35

People

(Reporter: ckitching, Assigned: ckitching)

Details

Attachments

(1 file)

null instanceof <anything> == false

As a result, things like:

if (x != null && x instanceof Toaster) { ... }

can lose the null check.
Attachment #8503706 - Flags: review?(rnewman)
Comment on attachment 8503706 [details] [diff] [review]
Don't check nullity before instanceof

Review of attachment 8503706 [details] [diff] [review]:
-----------------------------------------------------------------

Upstream needed.

::: mobile/android/base/LightweightTheme.java
@@ +342,5 @@
>              if (parent instanceof View) {
>                  curView = (View) parent;
>              }
>  
> +        } while(parent instanceof View);

Fix space while you're here.
Attachment #8503706 - Flags: review?(rnewman) → review+
https://hg.mozilla.org/mozilla-central/rev/0dc0ff9bb484
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 35
You need to log in before you can comment on or make changes to this bug.