Bug 1274901 - NullPointerException thrown in Tabs.java should be checked r=mcomella
authorJonathan Almeida (:jonalmeida) <jonalmeida942@gmail.com>
Tue, 24 May 2016 15:08:52 -0700
changeset 341387 c537b77d3d25d03493107c7a9c23587cd4d21abe
parent 341386 f5253aba046fab63710ccee19bcfc3300d9e6a25
child 341388 b5b132baef727992998454cfa8bb2c2aefe3f4ad
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1274901
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274901 - NullPointerException thrown in Tabs.java should be checked r=mcomella MozReview-Commit-ID: 2hMZn75BpeT
mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.toolbar;
 
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
 
+import android.support.annotation.Nullable;
 import android.support.v4.content.ContextCompat;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.BrowserApp;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.Telemetry;
@@ -398,17 +399,17 @@ public abstract class BrowserToolbar ext
         if (!isEditing()) {
             throw new IllegalStateException("Expected to be editing");
         }
 
         urlEditLayout.restoreTabEditingState(editingState);
     }
 
     @Override
-    public void onTabChanged(@NonNull Tab tab, Tabs.TabEvents msg, String data) {
+    public void onTabChanged(@Nullable Tab tab, Tabs.TabEvents msg, String data) {
         Log.d(LOGTAG, "onTabChanged: " + msg);
         final Tabs tabs = Tabs.getInstance();
 
         // These conditions are split into three phases:
         // * Always do first
         // * Handling specific to the selected tab
         // * Always do afterwards.
 
@@ -487,17 +488,17 @@ public abstract class BrowserToolbar ext
                     flags.add(UpdateFlags.FAVICON);
                     break;
 
                 case SECURITY_CHANGE:
                     flags.add(UpdateFlags.SITE_IDENTITY);
                     break;
             }
 
-            if (!flags.isEmpty()) {
+            if (!flags.isEmpty() && tab != null) {
                 updateDisplayLayout(tab, flags);
             }
         }
 
         switch (msg) {
             case SELECTED:
             case LOAD_ERROR:
             case LOCATION_CHANGE: