Skip to content

Commit

Permalink
Merge pull request #6555 from pec1985/TIMOB-18345-3_5_X
Browse files Browse the repository at this point in the history
[TIMOB-18345] 3.5.x back port iOS ListView - fix index out of bounds
  • Loading branch information
jonalter committed Jan 8, 2015
2 parents 16d2163 + e9181c5 commit 217d578
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,11 @@ - (void)updateSearchResults:(id)unused

-(NSIndexPath*)pathForSearchPath:(NSIndexPath*)indexPath
{
if (_searchResults != nil) {
if (_searchResults != nil && [_searchResults count] > indexPath.section) {
NSArray* sectionResults = [_searchResults objectAtIndex:indexPath.section];
return [sectionResults objectAtIndex:indexPath.row];
if([sectionResults count] > indexPath.row) {
return [sectionResults objectAtIndex:indexPath.row];
}
}
return indexPath;
}
Expand Down Expand Up @@ -1225,7 +1227,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
TiUIListSectionProxy* theSection = [self.listViewProxy sectionForIndex:realIndexPath.section];
NSInteger maxItem = 0;

if (_searchResults != nil) {
if (_searchResults != nil && [_searchResults count] > indexPath.section) {
NSArray* sectionResults = [_searchResults objectAtIndex:indexPath.section];
maxItem = [sectionResults count];
} else {
Expand Down

0 comments on commit 217d578

Please sign in to comment.