From 8dc0d35da4cfc847d4e3d28a41b549d40669de08 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 25 Mar 2011 08:35:51 -0700 Subject: Add insane workaround for source range bug. --- MobileCydia.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index 48aaef9..5e5cf65 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]; -- cgit v1.2.3