Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Merge pull request #186 from onevcat/fix/enum-crash
Browse files Browse the repository at this point in the history
Enum crash at EOF
  • Loading branch information
onevcat committed Oct 12, 2015
2 parents 0cd033e + 7c2b90b commit 5fe3930
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion VVDocumenter-Xcode/Commenter/VVEnumCommenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ - (NSString *)document {
NSTextCheckingResult *enumDefineResult = [enumDefineExpression firstMatchInString:self.code options:0 range:NSMakeRange(0, self.code.length)];

finalString = [finalString stringByAppendingString:[self.code substringWithRange:[enumDefineResult rangeAtIndex:0]]];
finalString = [finalString stringByAppendingString:@"\n"];
finalString = [finalString substringToIndex:finalString.length - 1];
finalString = [finalString stringByAppendingString:@" {\n"];

NSString *endPattern = @"\\}\\s*;";
NSString *enumPartsString = [[self.code vv_stringByReplacingRegexPattern:enumDefinePattern withString:@""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ -(VVTextResult *) vv_textResultUntilNextString:(NSString *)findString currentLoc
NSString *line = nil;
if (nextLineRange.location != NSNotFound && rangeToString.location != NSNotFound && nextLineRange.location <= rangeToString.location) {
NSRange lineRange = NSMakeRange(nextLineRange.location + 1, rangeToString.location - nextLineRange.location);
if (lineRange.location < [self length] && NSMaxRange(lineRange) < [self length]) {
if (lineRange.location < [self length] && NSMaxRange(lineRange) <= [self length]) {
line = [self substringWithRange:lineRange];
return [[VVTextResult alloc] initWithRange:lineRange string:line];
} else {
Expand Down
2 changes: 1 addition & 1 deletion VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
<string>/**
* &lt;#Description#&gt;
*/
typedef NS_ENUM(NSInteger, SIAlertViewBackgroundStyle){
typedef NS_ENUM(NSInteger, SIAlertViewBackgroundStyle) {
/**
* &lt;#Description#&gt;
*/
Expand Down

0 comments on commit 5fe3930

Please sign in to comment.