diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java index a28ad2e2..c04e4d4d 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ViewNode.java @@ -243,10 +243,12 @@ public abstract class ViewNode extends DoricContextHolder { gradientDrawable.setColors(colors.asArray().toIntArray()); } else { - JSValue start = prop.asObject().getProperty("start"); - JSValue end = prop.asObject().getProperty("end"); + if (prop.asObject().propertySet().contains("start") && prop.asObject().propertySet().contains("end")) { + JSValue start = prop.asObject().getProperty("start"); + JSValue end = prop.asObject().getProperty("end"); - gradientDrawable.setColors(new int[]{start.asNumber().toInt(), end.asNumber().toInt()}); + gradientDrawable.setColors(new int[]{start.asNumber().toInt(), end.asNumber().toInt()}); + } } JSValue orientation = prop.asObject().getProperty("orientation");