Guard against no children

This commit is contained in:
Luke Barnard 2017-04-25 17:05:54 +01:00
parent 1e9a2e80e9
commit 71a119376c

View file

@ -114,6 +114,9 @@ export default class Dropdown extends React.Component {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (!nextProps.children || nextProps.children.length === 0) {
return;
}
this._reindexChildren(nextProps.children); this._reindexChildren(nextProps.children);
const firstChild = nextProps.children[0]; const firstChild = nextProps.children[0];
this.setState({ this.setState({