Bug 703004 - Fix NPE on touch during startup [r=pcwalton]

Fix a couple of places that transform a point but
don't properly deal with the possible null return
value.
This commit is contained in:
Kartikaya Gupta 2011-11-16 13:42:45 -05:00
parent 0dd678f533
commit 73a1752d9c
2 changed files with 6 additions and 0 deletions

View File

@ -461,6 +461,9 @@ public class GeckoAppShell
/* Transform the point to the layer offset. */
PointF eventPoint = new PointF(origX, origY);
PointF geckoPoint = layerController.convertViewPointToLayerPoint(eventPoint);
if (geckoPoint == null) {
return false;
}
event.setLocation((int)Math.round(geckoPoint.x), (int)Math.round(geckoPoint.y));
GeckoAppShell.sendEventToGecko(new GeckoEvent(event));

View File

@ -594,6 +594,9 @@ public class PanZoomController
try {
PointF point = new PointF(motionEvent.getX(), motionEvent.getY());
point = mController.convertViewPointToLayerPoint(point);
if (point == null) {
return;
}
ret.put("x", (int)Math.round(point.x));
ret.put("y", (int)Math.round(point.y));
} catch(Exception ex) {