diff --git a/scm-ui-components/packages/ui-components/src/BranchSelector.js b/scm-ui-components/packages/ui-components/src/BranchSelector.js index a9ba12cc7e..d2145a8716 100644 --- a/scm-ui-components/packages/ui-components/src/BranchSelector.js +++ b/scm-ui-components/packages/ui-components/src/BranchSelector.js @@ -41,10 +41,13 @@ class BranchSelector extends React.Component { } 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() {