Skip to content

Commit

Permalink
Fix an issue introduced by the next Pull Request #22
Browse files Browse the repository at this point in the history
If self.currentPage is greater than self.pageControl.numberOfPages it crashes.
  • Loading branch information
Francisco Javier Trujillo Mata committed Dec 6, 2016
1 parent 0c19ac2 commit fd77cba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions DKCarouselView/DKCarouselView.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ -(void)setItems:(NSArray *)items {
_items = [items copy];

self.pageControl.numberOfPages = _items.count;
self.currentPage = MIN(self.currentPage, self.pageControl.numberOfPages);
self.pageControl.currentPage = self.currentPage;

_scrollView.scrollEnabled = _items.count > 1;
Expand Down

0 comments on commit fd77cba

Please sign in to comment.