Skip to content

Commit af181fb

Browse files
Artur Chruscielfacebook-github-bot
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 e082a61 commit af181fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,9 @@ protected synchronized void dropView(View view) {
570570
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
571571
for (int i = viewGroupManager.getChildCount(viewGroup) - 1; i >= 0; i--) {
572572
View child = viewGroupManager.getChildAt(viewGroup, i);
573-
if (mTagsToViews.get(child.getId()) != null) {
573+
if (child == null) {
574+
FLog.e(TAG, "Unable to drop null child view");
575+
} else if (mTagsToViews.get(child.getId()) != null) {
574576
dropView(child);
575577
}
576578
}

0 commit comments

Comments
 (0)