Permalink
Browse files

Fix NullPointerException in ReactShadowNode.toString()

Summary:
Fix `NullPointerException` in `ReactShadowNode.toString`
Simplified `ReactShadowNode.hasNewLayout` since I was already in there

It seems to me unlikely that this bug impacts anything but the debugging experience, so no biggie.
Closes #12953

Differential Revision: D4739215

fbshipit-source-id: 94955cc783216fdb8868fc8d08010e0d8a238052
  • Loading branch information...
petterh authored and facebook-github-bot committed Mar 20, 2017
1 parent 08c404d commit 242a58ffe08bf89ec4156ddc0bda89055f410886
Showing with 6 additions and 2 deletions.
  1. +6 −2 ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java
@@ -372,7 +372,7 @@ public void calculateLayout() {
}
public final boolean hasNewLayout() {
return mYogaNode == null ? false : mYogaNode.hasNewLayout();
return mYogaNode != null && mYogaNode.hasNewLayout();
}
public final void markLayoutSeen() {
@@ -770,7 +770,11 @@ public void setMeasureFunction(YogaMeasureFunction measureFunction) {
@Override
public String toString() {
return mYogaNode.toString();
if (mYogaNode != null) {
return mYogaNode.toString();
}
return getClass().getSimpleName() + " (virtual node)";
}
public void dispose() {

0 comments on commit 242a58f

Please sign in to comment.