From: Jay Freeman (saurik) Date: Fri, 25 Mar 2011 15:35:51 +0000 (-0700) Subject: Add insane workaround for source range bug. X-Git-Tag: v1.1.0%rc2~3 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/8dc0d35da4cfc847d4e3d28a41b549d40669de08 Add insane workaround for source range bug. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 48aaef99..5e5cf651 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -8601,7 +8601,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi if ([database_ era] != era_) return nil; - return [sources_ objectAtIndex:[indexPath row]]; + NSUInteger index([indexPath row]); + return index < [sources_ count] ? [sources_ objectAtIndex:index] : nil; } } - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -8617,6 +8618,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Source *source = [self sourceAtIndexPath:indexPath]; + if (source == nil) return; SourceController *controller = [[[SourceController alloc] initWithDatabase:database_ @@ -8636,6 +8638,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { Source *source = [self sourceAtIndexPath:indexPath]; + if (source == nil) return; + [Sources_ removeObjectForKey:[source key]]; [delegate_ _saveConfig]; [delegate_ reloadDataWithInvocation:nil];