From e5d975b5c75945b04d2e8cf7fa7ceac00194e6e8 Mon Sep 17 00:00:00 2001 From: landon Date: Mon, 8 Apr 2019 12:41:41 -0700 Subject: [PATCH] ignore dropView method when view is null (#24347) Summary: In #20288, we solved `com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:536)` by adding codes that prevent to run method on `view` object when `view.getId()` is null. But if `view` is null, `view.getId()` can make error about NullPointerException. So, I think `dropView` method needs to check if `view` is null. If you need more information, Please read #24346. [Android] [Fixed] - Ignore dropView method when view is null. Pull Request resolved: https://github.com/facebook/react-native/pull/24347 Differential Revision: D14833822 Pulled By: cpojer fbshipit-source-id: 88b6a05090ea8e8d6737c1f10b40e93649fab151 --- .../facebook/react/uimanager/NativeViewHierarchyManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index f5953bacdc..d42e865913 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -592,6 +592,10 @@ public class NativeViewHierarchyManager { */ protected synchronized void dropView(View view) { UiThreadUtil.assertOnUiThread(); + if (view == null) { + // Ignore this drop operation when view is null. + return; + } if (mTagsToViewManagers.get(view.getId()) == null) { // This view has already been dropped (likely due to a threading issue caused by async js // execution). Ignore this drop operation.