File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,8 @@ - (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)type
118
118
119
119
if (success) {
120
120
[self readRefs ];
121
- [self readCurrentBranch ];
122
121
revisionList = [[PBGitRevList alloc ] initWithRepository: self ];
122
+ [self readCurrentBranch ];
123
123
}
124
124
}
125
125
@@ -133,8 +133,10 @@ - (id) initWithURL: (NSURL*) path andRevSpecifier:(PBGitRevSpecifier*) rev
133
133
[self setFileURL: gitDirURL];
134
134
135
135
[self readRefs ];
136
- [ self selectBranch: [ self addBranch: rev]];
136
+
137
137
revisionList = [[PBGitRevList alloc ] initWithRepository: self ];
138
+ [self selectBranch: [self addBranch: rev]];
139
+
138
140
return self;
139
141
}
140
142
// The fileURL the document keeps is to the .git dir, but that’s pretty
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ @implementation PBGitRevList
18
18
- initWithRepository : (id ) repo
19
19
{
20
20
repository = repo;
21
-
22
- [self readCommits ];
23
21
[repository addObserver: self forKeyPath: @" currentBranch" options: 0 context: nil ];
24
22
25
23
return self;
@@ -31,10 +29,13 @@ - (void) readCommits
31
29
// we can check if the current branch is the same as the previous one
32
30
// and in that case we don't have to reload the revision list.
33
31
34
- // If no branch was selected, use the current HEAD
32
+ // If no branch is selected, don't do anything
33
+ if (![repository currentBranch ] || [[repository currentBranch ] count ] == 0 )
34
+ return ;
35
+
35
36
NSArray * selectedBranches = [[repository branches ] objectsAtIndexes: [repository currentBranch ]];
36
37
37
- // Apparently, we don't have a current branch yet. Let's skip it.
38
+ // Apparently, The selected index does not exist.. don't do anything
38
39
if ([selectedBranches count ] == 0 )
39
40
return ;
40
41
You can’t perform that action at this time.
0 commit comments