mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
W3CPointerEvents: fix NPE due to null targetView (#37785)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37785 Changelog: [Android] [Fixed] - W3CPointerEvents: fix NPE due to null targetView For reasons not entirely understood, we sometimes end up with a null `targetView` in this code path during the dispatch of an `ACTION_CANCEL`. This results in an NPE during the call to `getChildOffsetRelativeToRoot`. This change adds a null check before the call to avoid the crash. Reviewed By: cortinico Differential Revision: D46562263 fbshipit-source-id: fe60fe08929ed29a570a860d49915b6f5ae4a542
This commit is contained in:
committed by
Facebook GitHub Bot
parent
72eadcf769
commit
96fd107d61
+1
-1
@@ -615,7 +615,7 @@ public class JSPointerDispatcher {
|
||||
int activePointerId = eventState.getActivePointerId();
|
||||
List<ViewTarget> activeHitPath = eventState.getHitPathByPointerId().get(activePointerId);
|
||||
|
||||
if (!activeHitPath.isEmpty()) {
|
||||
if (!activeHitPath.isEmpty() && targetView != null) {
|
||||
boolean listeningForCancel =
|
||||
isAnyoneListeningForBubblingEvent(activeHitPath, EVENT.CANCEL, EVENT.CANCEL_CAPTURE);
|
||||
if (listeningForCancel) {
|
||||
|
||||
Reference in New Issue
Block a user