mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 22:47:39 +00:00
Catch invalid color during parse.
This commit is contained in:
@@ -50,7 +50,16 @@ class ColorField extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get color() {
|
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() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user