fix NPE when a touch event is sent to an unknown Android platform view (#9476)

This commit is contained in:
Amir Hardon 2019-06-25 09:45:20 -07:00 committed by GitHub
parent ebb5b909fb
commit 3390019225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,11 +192,10 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
parsePointerCoordsList(touch.rawPointerCoords, density)
.toArray(new PointerCoords[touch.pointerCount]);
View view = vdControllers.get(touch.viewId).getView();
if (view == null) {
throw new IllegalStateException("Sending touch to an unknown view with id: "
+ touch.viewId);
if (!vdControllers.containsKey(touch.viewId)) {
throw new IllegalStateException("Sending touch to an unknown view with id: " + touch.viewId);
}
View view = vdControllers.get(touch.viewId).getView();
MotionEvent event = MotionEvent.obtain(
touch.downTime.longValue(),