Skip to content
Browse files

Merge pull request #163 from pandamonia/master

Fix: Sales View Controller Out-of-bounds Exception
  • Loading branch information...
2 parents 92b4e9b + 5582c18 commit 664d4cdd4be33177784174c5e1063bf138b6f6f9 @omz omz committed Sep 8, 2011
Showing with 3 additions and 3 deletions.
  1. +1 −1 Classes/ReportDetailViewController.m
  2. +2 −2 Classes/SalesViewController.m
View
2 Classes/ReportDetailViewController.m
@@ -273,7 +273,7 @@ - (void)reloadData
NSDictionary *salesByProduct = [paidDownloadsByCountryAndProduct objectForKey:[country uppercaseString]];
sales = [[[salesByProduct allValues] valueForKeyPath:@"@sum.self"] integerValue];
}
- NSString *subtitle = [NSString stringWithFormat:@"%@: %i sales", [[CountryDictionary sharedDictionary] nameForCountryCode:country], sales];
+ NSString *subtitle = [NSString stringWithFormat:@"%@: %i %@", [[CountryDictionary sharedDictionary] nameForCountryCode:country], sales, sales == 1 ? @"sale" : @"sales"];
ReportDetailEntry *entry = [ReportDetailEntry entryWithRevenue:revenue percentage:percentage subtitle:subtitle country:country product:nil];
[sortedEntries addObject:entry];
}
View
4 Classes/SalesViewController.m
@@ -491,7 +491,7 @@ - (NSString *)graphView:(GraphView *)graphView labelForBarAtIndex:(NSUInteger)in
- (NSString *)graphView:(GraphView *)graphView labelForSectionAtIndex:(NSUInteger)index
{
if (selectedTab == 0) {
- if ([((showWeeks) ? self.sortedWeeklyReports : self.sortedDailyReports) count] > 0) {
+ if ([((showWeeks) ? self.sortedWeeklyReports : self.sortedDailyReports) count] > index) {
Report *report = [((showWeeks) ? self.sortedWeeklyReports : self.sortedDailyReports) objectAtIndex:index];
NSDateFormatter *monthFormatter = [[[NSDateFormatter alloc] init] autorelease];
[monthFormatter setDateFormat:@"MMM '´'yy"];
@@ -500,7 +500,7 @@ - (NSString *)graphView:(GraphView *)graphView labelForSectionAtIndex:(NSUIntege
return @"N/A";
}
} else {
- if ([self.sortedCalendarMonthReports count] > 0) {
+ if ([self.sortedCalendarMonthReports count] > index) {
id<ReportSummary> report = [self.sortedCalendarMonthReports objectAtIndex:index];
NSDateFormatter *yearFormatter = [[[NSDateFormatter alloc] init] autorelease];
[yearFormatter setDateFormat:@"yyyy"];

0 comments on commit 664d4cd

Please sign in to comment.
Something went wrong with that request. Please try again.