Permalink
Browse files

Fix potential crash when touches go offscreen.

  • Loading branch information...
1 parent 08ee8ba commit cb4802b997eb4554536d093e41413b19fe1b4528 @msanders msanders committed May 23, 2012
Showing with 7 additions and 12 deletions.
  1. +7 −12 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 cb4802b

Please sign in to comment.