Permalink
Browse files

fix NullPointerException Caused by manageChildren

Summary: Closes #8991

Differential Revision: D3612777

Pulled By: dmmiller

fbshipit-source-id: d8da5ef8354cdaf55d8a3efbc2bfbc2aef74a044
  • Loading branch information...
1 parent feb2825 commit c21d3a10291b02534b8cdcb936f046d1a59c1ba7 @ASCE1885 ASCE1885 committed with Facebook Github Bot 7 Jul 25, 2016
@@ -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;
@@ -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
@@ -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) {

0 comments on commit c21d3a1

Please sign in to comment.