Bug 1160349 - Fix NPE due to no selected tab; r=kats
authorJim Chen <nchen@mozilla.com>
Tue, 05 May 2015 14:24:09 -0400
changeset 242399 ba45d78e7b808370798c85d779a50c7817dce7b5
parent 242398 d4e4b4b55b5c723591323b708b0c1007ef971b94
child 242400 e665a4452667a863893d8b4d23194dab610a2d53
push id28693
push userkwierso@gmail.com
push dateWed, 06 May 2015 03:23:28 +0000
treeherdermozilla-central@f938222ff4ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1160349 - Fix NPE due to no selected tab; r=kats
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -586,32 +586,34 @@ class GeckoLayerClient implements LayerV
             RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
             RectF pageRect = RectUtils.scaleAndRound(cssPageRect, zoom);
             final ImmutableViewportMetrics newMetrics = currentMetrics
                 .setViewportOrigin(offsetX, offsetY)
                 .setPageRect(pageRect, cssPageRect)
-                .setIsRTL(tab.getIsRTL());
+                .setIsRTL(tab != null ? tab.getIsRTL() : false);
             // Since we have switched to displaying a different document, we need to update any
             // viewport-related state we have lying around. This includes mGeckoViewport and
             // mViewportMetrics. Usually this information is updated via handleViewportMessage
             // while we remain on the same document.
             post(new Runnable() {
                 public void run() {
                     mGeckoViewport = newMetrics;
-            mView.setBackgroundColor(tab.getBackgroundColor());
-            setZoomConstraints(tab.getZoomConstraints());
+            if (tab != null) {
+                mView.setBackgroundColor(tab.getBackgroundColor());
+                setZoomConstraints(tab.getZoomConstraints());
+            }
             // At this point, we have just switched to displaying a different document than we
             // we previously displaying. This means we need to abort any panning/zooming animations
             // that are in progress and send an updated display port request to browser.js as soon
             // as possible. The call to PanZoomController.abortAnimation accomplishes this by calling the
             // forceRedraw function, which sends the viewport to gecko. The display port request is
             // actually a full viewport update, which is fine because if browser.js has somehow moved to
             // be out of sync with this first-paint viewport, then we force them back in sync.