fixed issue: Cannot read property 'find' of undefined for changesets

This commit is contained in:
Florian Scholdei
2019-04-24 16:55:24 +02:00
parent d2c2a1b23c
commit 1cd6872afe

View File

@@ -41,10 +41,13 @@ class BranchSelector extends React.Component<Props, State> {
}
componentDidMount() {
const selectedBranch = this.props.branches.find(
branch => branch.name === this.props.selectedBranch
);
this.setState({ selectedBranch });
const { branches } = this.props;
if (branches) {
const selectedBranch = branches.find(
branch => branch.name === this.props.selectedBranch
);
this.setState({ selectedBranch });
}
}
render() {