mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 12:50:30 +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() {
|
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() {
|
||||||
|
|
Loading…
Reference in a new issue