diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-25 08:35:51 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-25 08:35:51 -0700 |
commit | 8dc0d35da4cfc847d4e3d28a41b549d40669de08 (patch) | |
tree | 2652a298d1c5cdf797b63ef3ed1142332086e0c9 | |
parent | 383a58aca9ce0b1c36ab6439cde44c3598d19f65 (diff) |
Add insane workaround for source range bug.
-rw-r--r-- | MobileCydia.mm | 6 |
1 files changed, 5 insertions, 1 deletions
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]; |