Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed NSRangeException in TKCalendarMonthView #212

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/TapkuLibrary/TKCalendarMonthView.m
Expand Up @@ -321,12 +321,14 @@ - (void) drawRect:(CGRect)rect {
UIFont *font = [UIFont boldSystemFontOfSize:dateFontSize];
UIFont *font2 =[UIFont boldSystemFontOfSize:dotFontSize];
UIColor *color = [UIColor grayColor];

NSInteger markCount = [marks count];

if(firstOfPrev>0){
[color set];
for(int i = firstOfPrev;i<= lastOfPrev;i++){
r = [self rectForCellAtIndex:index];
if ([marks count] > 0)
if (markCount > 0 && index < markCount)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2];
Expand All @@ -342,7 +344,7 @@ - (void) drawRect:(CGRect)rect {
r = [self rectForCellAtIndex:index];
if(today == i) [[UIColor whiteColor] set];

if ([marks count] > 0)
if (markCount > 0 && index < markCount)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2];
Expand All @@ -354,7 +356,7 @@ - (void) drawRect:(CGRect)rect {
int i = 1;
while(index % 7 != 0){
r = [self rectForCellAtIndex:index] ;
if ([marks count] > 0)
if (markCount > 0 && index < markCount)
[self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
else
[self drawTileInRect:r day:i mark:NO font:font font2:font2];
Expand Down