Android: ensure start & end are not null

This commit is contained in:
王劲鹏 2020-05-09 11:39:58 +08:00 committed by osborn
parent d060e1427c
commit c2264e621c

View File

@ -243,10 +243,12 @@ public abstract class ViewNode<T extends View> 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");