mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 05:11:15 +01:00
Merge pull request #204 from orangemug/fix/catch-invalid-color
Catch invalid color
This commit is contained in:
commit
bac59d595d
1 changed files with 8 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue