Skip to content

Commit

Permalink
PageNavigator: fix exception when setting selectedIndex to -1
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Oct 29, 2024
1 parent 08e0e27 commit 517771b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/feathers/controls/navigators/PageNavigator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ class PageNavigator extends BaseNavigator implements IIndexSelector implements I
}
}
if (pendingSelectedIndex != NO_PENDING_SELECTED_INDEX) {
if (pendingSelectedIndex < this._dataProvider.length) {
if (pendingSelectedIndex >= 0 && pendingSelectedIndex < this._dataProvider.length) {
this._selectedIndex = pendingSelectedIndex;
this._selectedItem = this._dataProvider.get(pendingSelectedIndex);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/feathers/controls/navigators/TabNavigator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class TabNavigator extends BaseNavigator implements IIndexSelector implements ID
}
}
if (pendingSelectedIndex != NO_PENDING_SELECTED_INDEX) {
if (pendingSelectedIndex < this._dataProvider.length) {
if (pendingSelectedIndex >= 0 && pendingSelectedIndex < this._dataProvider.length) {
this._selectedIndex = pendingSelectedIndex;
this._selectedItem = this._dataProvider.get(pendingSelectedIndex);
} else {
Expand Down

0 comments on commit 517771b

Please sign in to comment.