Skip to content

fix NullPointerException Caused by manageChildren #8991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

package com.facebook.react.uimanager;

import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;

import android.content.res.Resources;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
Expand Down Expand Up @@ -39,6 +36,9 @@
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;

import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;

/**
* Delegate of {@link UIManagerModule} that owns the native view hierarchy and mapping between
* native view names used in JS and corresponding instances of {@link ViewManager}. The
Expand Down Expand Up @@ -232,17 +232,20 @@ private static String constructManageChildrenErrorMessage(
@Nullable int[] tagsToDelete) {
StringBuilder stringBuilder = new StringBuilder();

stringBuilder.append("View tag:" + viewToManage.getId() + "\n");
stringBuilder.append(" children(" + viewManager.getChildCount(viewToManage) + "): [\n");
for (int index=0; index<viewManager.getChildCount(viewToManage); index+=16) {
for (int innerOffset=0;
((index+innerOffset) < viewManager.getChildCount(viewToManage)) && innerOffset < 16;
innerOffset++) {
stringBuilder.append(viewManager.getChildAt(viewToManage, index+innerOffset).getId() + ",");
if (null != viewToManage) {
stringBuilder.append("View tag:" + viewToManage.getId() + "\n");
stringBuilder.append(" children(" + viewManager.getChildCount(viewToManage) + "): [\n");
for (int index=0; index<viewManager.getChildCount(viewToManage); index+=16) {
for (int innerOffset=0;
((index+innerOffset) < viewManager.getChildCount(viewToManage)) && innerOffset < 16;
innerOffset++) {
stringBuilder.append(viewManager.getChildAt(viewToManage, index+innerOffset).getId() + ",");
}
stringBuilder.append("\n");
}
stringBuilder.append("\n");
stringBuilder.append(" ],\n");
}
stringBuilder.append(" ],\n");

if (indicesToRemove != null) {
stringBuilder.append(" indicesToRemove(" + indicesToRemove.length + "): [\n");
for (int index = 0; index < indicesToRemove.length; index += 16) {
Expand Down