Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Protect endless iteration when setting index for slider view.
Browse files Browse the repository at this point in the history
  • Loading branch information
qianyuan.wqy committed Sep 30, 2019
1 parent f2786a1 commit cb7fe03
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm
Expand Up @@ -148,6 +148,10 @@ - (UIView *)getItemAtIndex:(NSInteger)index

- (void)setCurrentIndex:(NSInteger)currentIndex
{
if (_currentIndex == currentIndex) {
return;
}

if (currentIndex >= _itemViews.count || currentIndex < 0) {
currentIndex = 0;
}
Expand Down

0 comments on commit cb7fe03

Please sign in to comment.