Permalink
Browse files

Fixed the array access beyond bounds.

  • Loading branch information...
1 parent df9dd09 commit 27812f06d11188314aed7c392bc268efd32bfa63 @shu223 shu223 committed Feb 2, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 Model/GBMethodData.m
  2. +1 −1 Processing/GBCommentsProcessor.m
@@ -204,7 +204,7 @@ - (BOOL)formatTypesFromArray:(NSArray *)types toArray:(NSMutableArray *)array pr
if (isLast || isPointer) appendSpace = NO;
// We should not add space between components of a protocol (i.e. id<ProtocolName> should be written without any space). Because we've alreay
- if (!isLast && [[types objectAtIndex:idx+1] isEqualToString:@"<"])
+ if (!isLast && idx+1 < [types count] && [[types objectAtIndex:idx+1] isEqualToString:@"<"])
insideProtocol = YES;
else if ([type isEqualToString:@">"])
insideProtocol = NO;
@@ -406,7 +406,7 @@ - (BOOL)processAvailabilityBlockInString:(NSString *)string lines:(NSArray *)lin
if ([components count] == 0) return NO;
// Get data from captures. Index 1 is directive, index 2 description text.
- NSString *description = [components objectAtIndex:3];
+ NSString *description = [components count] > 3 ? [components objectAtIndex:3] : @"";
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {

0 comments on commit 27812f0

Please sign in to comment.