Permalink
Browse files

Fixes bug crash when UIViewController allocated and pushViewControlle…

…r it in delegate.didSelectDate.
  • Loading branch information...
1 parent 9c3ceb3 commit d1255bf27b967236c79fc5d72e43e0197cccb783 @nakanomi nakanomi committed Jul 29, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/TapkuLibrary/TKCalendarMonthView.m
@@ -487,6 +487,14 @@ - (NSDate*) dateSelected{
- (void) reactToTouch:(UITouch*)touch down:(BOOL)down{
CGPoint p = [touch locationInView:self];
+ /*
+ When a UIViewController allocated and pushViewController it in delegate.- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)date.
+ p.x is over self.bounds.size.width(a cause -- unknown).
+ And column becomes 7 or more.
+ It is if it is the 4th [ or more ] row, App will crash (e.g. select 2012/07/29).
+ So I added check range of p.x.
+ */
+ if(p.x > self.bounds.size.width || p.x < 0) return;
if(p.y > self.bounds.size.height || p.y < 0) return;
int column = p.x / 46, row = p.y / 44;

0 comments on commit d1255bf

Please sign in to comment.