mirror of
https://github.com/maputnik/editor.git
synced 2025-12-26 16:10:01 +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() {
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user