From 9760a326c9c829a832672dcb597862e4fc3074eb Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Sat, 20 Jun 2020 17:39:17 -0700 Subject: [PATCH] Fix MountingManager NPE Summary: Fix NullPointerException. Changelog: [Internal] Reviewed By: shergin Differential Revision: D22153157 fbshipit-source-id: 77be1456a2b7f6429d2dce6eac5d9d0bca362c27 --- .../react/fabric/mounting/MountingManager.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index b845b335fd8..fa3ee13304b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -455,14 +455,17 @@ public class MountingManager { } View view = viewState.mView; - ViewParent parentView = view.getParent(); - - if (parentView != null) { - throw new IllegalStateException( - "Cannot delete view that is still attached to parent: [" + reactTag + "]"); - } if (view != null) { + ViewParent parentView = view.getParent(); + + if (parentView != null) { + ReactSoftException.logSoftException( + TAG, + new IllegalStateException( + "Warning: Deleting view that is still attached to parent: [" + reactTag + "]")); + } + dropView(view); } else { mTagToViewState.remove(reactTag);