mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 20:41:19 +01:00
Catch invalid color during parse.
This commit is contained in:
parent
949bd783f5
commit
b20c69b15a
1 changed files with 10 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue