mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 14:37:27 +00:00
Merge pull request #204 from orangemug/fix/catch-invalid-color
Catch invalid color
This commit is contained in:
@@ -50,7 +50,14 @@ class ColorField extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get color() {
|
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() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user