From 619e759717acfb78ec70620268233891857a3c73 Mon Sep 17 00:00:00 2001 From: Anthony Gorb Date: Fri, 30 Nov 2018 17:05:03 +0200 Subject: [PATCH] Fixed infinite loop if bounds.size.height less than rowHeight --- Classes/GDIIndexBar.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/GDIIndexBar.m b/Classes/GDIIndexBar.m index 061fae9..45135d6 100644 --- a/Classes/GDIIndexBar.m +++ b/Classes/GDIIndexBar.m @@ -349,7 +349,7 @@ - (NSUInteger)numberOfDisplayableRows { CGFloat rowHeight = _lineHeight + _textSpacing; CGFloat desiredHeight = _textSpacing * 2 + rowHeight * _numberOfIndexes; - if (desiredHeight > self.bounds.size.height) { + if (desiredHeight > self.bounds.size.height && self.bounds.size.height >= rowHeight) { NSUInteger numberOfRowsThatFit = self.bounds.size.height / rowHeight; numberOfRowsThatFit -= (numberOfRowsThatFit%2==0) ? 1 : 0; return numberOfRowsThatFit;