mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+1
-1
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user