Skip to content

Commit 0a48e0a

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

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
@@ -544,7 +544,9 @@ protected synchronized void dropView(View view) {
544544
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
545545
for (int i = viewGroupManager.getChildCount(viewGroup) - 1; i >= 0; i--) {
546546
View child = viewGroupManager.getChildAt(viewGroup, i);
547-
if (mTagsToViews.get(child.getId()) != null) {
547+
if (child == null) {
548+
FLog.e(TAG, "Unable to drop null child view");
549+
} else if (mTagsToViews.get(child.getId()) != null) {
548550
dropView(child);
549551
}
550552
}

0 commit comments

Comments
 (0)