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 https://github.com/facebook/react-native/pull/12953

Differential Revision: D4739215

fbshipit-source-id: 94955cc783216fdb8868fc8d08010e0d8a238052
This commit is contained in:
Petter Hesselberg
2017-03-20 12:44:41 -07:00
committed by Facebook Github Bot
parent 08c404d293
commit 242a58ffe0

View File

@@ -372,7 +372,7 @@ public class ReactShadowNode {
}
public final boolean hasNewLayout() {
return mYogaNode == null ? false : mYogaNode.hasNewLayout();
return mYogaNode != null && mYogaNode.hasNewLayout();
}
public final void markLayoutSeen() {
@@ -770,7 +770,11 @@ public class ReactShadowNode {
@Override
public String toString() {
return mYogaNode.toString();
if (mYogaNode != null) {
return mYogaNode.toString();
}
return getClass().getSimpleName() + " (virtual node)";
}
public void dispose() {