diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index db170dd0f29..d2da8ef30e0 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -13,6 +13,7 @@ import org.mozilla.gecko.gfx.IntSize; import org.mozilla.gecko.gfx.LayerView; import org.mozilla.gecko.gfx.RectUtils; import org.mozilla.gecko.gfx.ScreenshotLayer; +import org.mozilla.gecko.gfx.TouchEventHandler; import org.mozilla.gecko.mozglue.DirectBufferAllocator; import org.mozilla.gecko.util.EventDispatcher; import org.mozilla.gecko.util.FloatUtils; @@ -1502,7 +1503,10 @@ public class GeckoAppShell getMainHandler().post(new Runnable() { public void run() { LayerView view = GeckoApp.mAppContext.getLayerView(); - view.getTouchEventHandler().handleEventListenerAction(!defaultPrevented); + TouchEventHandler handler = (view == null ? null : view.getTouchEventHandler()); + if (handler != null) { + handler.handleEventListenerAction(!defaultPrevented); + } } }); }