Permalink
Browse files

Fix potential crash when touches go offscreen.

  • Loading branch information...
1 parent 4b9efec commit 2076033fcd8c594eff9e70a99dd79658b1f7d5fe @msanders msanders committed May 23, 2012
Showing with 7 additions and 12 deletions.
  1. +7 −12 src/TapkuLibrary/TKCalendarMonthView.m
View
19 src/TapkuLibrary/TKCalendarMonthView.m
@@ -436,17 +436,12 @@ - (void) selectDay:(int)day{
[self addSubview:self.selectedImageView];
self.currentDay.text = [NSString stringWithFormat:@"%d",day];
-
- if ([marks count] > 0) {
-
- if([[marks objectAtIndex: row * 7 + column ] boolValue]){
- [self.selectedImageView addSubview:self.dot];
- }else{
- [self.dot removeFromSuperview];
- }
-
-
- }else{
+
+ NSInteger markOffset = row * 7 + column;
+
+ if ([marks count] > markOffset && [[marks objectAtIndex:markOffset] boolValue]) {
+ [self.selectedImageView addSubview:self.dot];
+ } else {
[self.dot removeFromSuperview];
}
@@ -990,4 +985,4 @@ - (UIImageView *) shadow{
return shadow;
}
-@end
+@end

0 comments on commit 2076033

Please sign in to comment.