Merge pull request #204 from orangemug/fix/catch-invalid-color

Catch invalid color
This commit is contained in:
Orange Mug 2017-11-29 21:58:06 +00:00 committed by GitHub
commit bac59d595d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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