Skip to content

Commit 8744e00

Browse files
Artur Chruscielgrabbou
Artur Chrusciel
authored andcommitted
Check if child view != null before dropping (#20465)
Summary: Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.). Fixes #20288 Pull Request resolved: #20465 Differential Revision: D10113976 Pulled By: hramos fbshipit-source-id: 34f5654f3bdbc63eb7f7d0b5c94885576fc3cdcd
1 parent b01ac3b commit 8744e00

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,9 @@ protected synchronized void dropView(View view) {
573573
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
574574
for (int i = viewGroupManager.getChildCount(viewGroup) - 1; i >= 0; i--) {
575575
View child = viewGroupManager.getChildAt(viewGroup, i);
576-
if (mTagsToViews.get(child.getId()) != null) {
576+
if (child == null) {
577+
FLog.e(TAG, "Unable to drop null child view");
578+
} else if (mTagsToViews.get(child.getId()) != null) {
577579
dropView(child);
578580
}
579581
}

0 commit comments

Comments
 (0)