Bug 859100 - Fix NullPointerException in BrowserToolbar.canToolbarHide. r=kats

If this is called before initializeChrome is called, GeckoApp.getLayerView
can be null.
This commit is contained in:
Chris Lord 2013-04-11 17:33:40 +01:00
Родитель 3bd6201a6e
Коммит bf76035c10
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -6,6 +6,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
@ -495,9 +496,12 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private boolean canToolbarHide() {
// Forbid the toolbar from hiding if hiding the toolbar would cause
// the page to go into overscroll.
ImmutableViewportMetrics metrics = GeckoApp.mAppContext.getLayerView().
getLayerClient().getViewportMetrics();
return (metrics.getPageHeight() >= metrics.getHeight());
LayerView layerView = GeckoApp.mAppContext.getLayerView();
if (layerView != null) {
ImmutableViewportMetrics metrics = layerView.getViewportMetrics();
return (metrics.getPageHeight() >= metrics.getHeight());
}
return false;
}
public void animateVisibility(boolean show) {