Permalink
Browse files

Fixes a potential crash when loading payments

  • Loading branch information...
1 parent dc46e6e commit 92b4e9b912a99172bd27bbad75351f9e3bdd664a Ole Zorn committed Sep 7, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 Classes/ReportDownloadOperation.m
@@ -416,7 +416,7 @@ - (void)parsePaymentsPage:(NSString *)paymentsPage inAccount:(ASAccount *)accoun
[paymentMonthFormatter setDateFormat:@"MMM yy"];
NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
[calendar setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
- NSArray *amounts = [[graphDict objectForKey:@"data"] objectAtIndex:1];
+ NSArray *amounts = ([[graphDict objectForKey:@"data"] count] >= 2) ? [[graphDict objectForKey:@"data"] objectAtIndex:1] : nil;
NSArray *labels = [graphDict objectForKey:@"labels"];
NSArray *legend = [graphDict objectForKey:@"legend"];
if (legend && [legend isKindOfClass:[NSArray class]] && [legend count] == 2) {

0 comments on commit 92b4e9b

Please sign in to comment.