Skip to content

Commit

Permalink
Merge pull request #9714 from Expensify/Rory-FixOptionSelectorCrash
Browse files Browse the repository at this point in the history
Fix OptionsSelector crash

(cherry picked from commit e45ef30)
  • Loading branch information
NikkiWines authored and OSBotify committed Jul 5, 2022
1 parent 4c0c7f0 commit ec2c375
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/OptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ class OptionsSelector extends Component {
this.setState({
allOptions: newOptions,
focusedIndex: newFocusedIndex,
}, () => {
if (this.state.allOptions.length <= this.state.focusedIndex) {
return;
}
this.scrollToIndex(this.state.focusedIndex);
});

if (newOptions.length <= newFocusedIndex) {
return;
}
this.scrollToIndex(newFocusedIndex);
}

componentWillUnmount() {
Expand Down

0 comments on commit ec2c375

Please sign in to comment.