Skip to content

Commit d0ecbf5

Browse files
committed
protect against undefined attribute access for color
1 parent 0abb71b commit d0ecbf5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/DateRange/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class DateRange extends Component {
102102
}
103103
const { rangeColors, ranges } = this.props;
104104
const focusedRange = this.props.focusedRange || this.state.focusedRange;
105-
const color = ranges[focusedRange[0]].color || rangeColors[focusedRange[0]] || color;
105+
const color = ranges[focusedRange[0]]?.color || rangeColors[focusedRange[0]] || color;
106106
this.setState({ preview: { ...val.range, color } });
107107
};
108108
render() {

0 commit comments

Comments
 (0)