Android: Fix NPE in configuring brush

Fixing a NPE found when running the Example test, since the brush
returned from getDefinedBrush() may be null.
This commit is contained in:
Greg Hogan
2016-07-29 14:54:50 -07:00
parent cf6ec2c022
commit d353fca7db
@@ -310,7 +310,9 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
mPath.computeBounds(box, true);
}
PropHelper.RNSVGBrush brush = getSvgShadowNode().getDefinedBrush(colors.getString(1));
brush.setupPaint(paint, box, mScale, opacity);
if (brush != null) {
brush.setupPaint(paint, box, mScale, opacity);
}
} else {
// TODO: Support pattern.
FLog.w(ReactConstants.TAG, "RNSVG: Color type " + colorType + " not supported!");