Add check for invalid color scheme (#6828)

* add check for invalid scheme

* revert package-lock.json

* revert again
This commit is contained in:
Krist Wongsuphasawat 2019-02-08 10:47:57 -08:00 committed by GitHub
parent e14c0cf9a3
commit 1c090df4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,9 +71,10 @@ export default class ColorSchemeControl extends React.PureComponent {
// For categorical scheme, display all the colors
// For sequential scheme, show 10 or interpolate to 10.
// Sequential schemes usually have at most 10 colors.
const colors = isLinear
? currentScheme.getColors(10)
: currentScheme.colors;
let colors = [];
if (currentScheme) {
colors = isLinear ? currentScheme.getColors(10) : currentScheme.colors;
}
return (
<ul className="color-scheme-container">