Fix a crashing bug in PBGitRepository

A ref might be less than 11 characters. In those cases, the substringToIndex
would produce a fatal out-of-bounds.
This commit is contained in:
Pieter de Bie
2008-09-06 22:29:18 +02:00
parent 8e949184bc
commit 96917943b6
+1 -1
View File
@@ -155,7 +155,7 @@ static NSString* gitPath;
else
sha = [components objectAtIndex:2];
if ([[ref substringToIndex:11] isEqualToString:@"refs/heads/"]) {
if ([ref length] > 11 && [[ref substringToIndex:11] isEqualToString:@"refs/heads/"]) {
NSString* branch = [ref substringFromIndex:11];
[newBranches addObject: branch];
}