From 3b569b8affc55d618750cc5de2681d0afe67b601 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 7 Jul 2021 13:35:22 -0700 Subject: [PATCH] Ensure that TouchEvent is initialized with a valid MotionEvent Summary: It is unlikely but possible that the crash T94864568 is caused by a TouchEvent being initialized with a null MotionEvent. Regardless, we should guard against this case. Changelog: [Internal] Reviewed By: ShikaSD Differential Revision: D29594750 fbshipit-source-id: 3a409b716a9f1eec8017002ae7e23273677e53ba --- .../java/com/facebook/react/uimanager/events/TouchEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java index fbcb97b1cc3..6d8f644411f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java @@ -43,7 +43,7 @@ public class TouchEvent extends Event { -1, viewTag, touchEventType, - motionEventToCopy, + Assertions.assertNotNull(motionEventToCopy), gestureStartTime, viewX, viewY, @@ -67,7 +67,7 @@ public class TouchEvent extends Event { surfaceId, viewTag, touchEventType, - motionEventToCopy, + Assertions.assertNotNull(motionEventToCopy), gestureStartTime, viewX, viewY,