Skip to content

Commit

Permalink
Fix crash when a tab is removed and user is on the last tab
Browse files Browse the repository at this point in the history
  • Loading branch information
flambert committed Aug 24, 2016
1 parent 2a89cb1 commit 664a402
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MRGPagerController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MRGPagerController'
s.version = '1.0.12'
s.version = '1.0.13'
s.summary = 'An highly customizable pager controller.'
s.homepage = 'https://github.com/Mirego/MRGPagerController'
s.license = 'BSD 3-Clause'
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/MRGPagerTitleStrip.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ - (void)scrollToIndex:(CGFloat)index animated:(BOOL)animated {

if ([self.buttons count] > 0 && (self.scrollView.contentSize.width > CGRectGetWidth(self.scrollView.bounds))) {
CGFloat offset = 0;
NSInteger prevButtonIndex = MAX(MIN(floorf(index), [self.buttons count]), 0);
NSInteger prevButtonIndex = MAX(MIN(floorf(index), [self.buttons count] - 1), 0);
NSInteger nextButtonIndex = MIN(ceilf(index), [self.buttons count] - 1);

for (NSInteger ii = 0, count = prevButtonIndex; ii < count; ++ii) {
Expand Down

0 comments on commit 664a402

Please sign in to comment.