From 3390019225a2c57d600e787ee3c71e11ffbcce20 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Tue, 25 Jun 2019 09:45:20 -0700 Subject: [PATCH] fix NPE when a touch event is sent to an unknown Android platform view (#9476) --- .../flutter/plugin/platform/PlatformViewsController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 8ea704b39..201cfcb63 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -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(), -- GitLab