Catch invalid color during parse.

This commit is contained in:
orangemug 2017-11-29 18:00:52 +00:00
parent 949bd783f5
commit b20c69b15a

View file

@ -50,7 +50,16 @@ class ColorField extends React.Component {
}
get color() {
return Color(this.props.value || '#fff').rgb()
let color = Color("rgb(255,255,255)");
// Catch invalid color.
try {
return Color(this.props.value).rgb()
}
catch(err) {
console.warn("Error parsing color: ", err);
}
return color;
}
render() {