Bug 785596 - Guard against null gfx objects during touch event handling. r=sriram
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 27 Aug 2012 20:34:58 -0400
changeset 105657 c7e7eb166dd9ac82b7ecf7b6892eac4fcac43d5c
parent 105656 12504471edefed3247487d780860893ae84224db
child 105658 1bbd007974326b6bd373b4f87afb5b22d73a8870
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerssriram
bugs785596
milestone18.0a1
Bug 785596 - Guard against null gfx objects during touch event handling. r=sriram
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -8,16 +8,17 @@ package org.mozilla.gecko;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.gfx.GeckoLayerClient;
 import org.mozilla.gecko.gfx.GfxInfoThread;
 import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
 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;
 import org.mozilla.gecko.util.GeckoBackgroundThread;
 import org.mozilla.gecko.util.GeckoEventListener;
 
 import android.app.Activity;
 import android.app.ActivityManager;
@@ -1497,17 +1498,20 @@ public class GeckoAppShell
             }
         });
     }
 
     public static void notifyDefaultPrevented(final boolean defaultPrevented) {
         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);
+                }
             }
         });
     }
 
     public static boolean isNetworkLinkUp() {
         ConnectivityManager cm = (ConnectivityManager)
             GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
         NetworkInfo info = cm.getActiveNetworkInfo();