@@ -637,18 +637,22 @@ - (NSArray *)referenceNamesWithError:(NSError **)error {
637637}
638638
639639- (NSURL *)fileURL {
640- const char *path = git_repository_workdir (self.git_repository );
640+ const char *cPath = git_repository_workdir (self.git_repository );
641641 // bare repository, you may be looking for gitDirectoryURL
642- if (path == NULL ) return nil ;
642+ if (cPath == NULL ) return nil ;
643643
644- return [NSURL fileURLWithPath: @(path) isDirectory: YES ];
644+ NSString *path = @(cPath);
645+ NSAssert (path, @" workdir is nil" );
646+ return [NSURL fileURLWithPath: path isDirectory: YES ];
645647}
646648
647649- (NSURL *)gitDirectoryURL {
648- const char *path = git_repository_path (self.git_repository );
649- if (path == NULL ) return nil ;
650+ const char *cPath = git_repository_path (self.git_repository );
651+ if (cPath == NULL ) return nil ;
650652
651- return [NSURL fileURLWithPath: @(path) isDirectory: YES ];
653+ NSString *path = @(cPath);
654+ NSAssert (path, @" gitdirectory is nil" );
655+ return [NSURL fileURLWithPath: path isDirectory: YES ];
652656}
653657
654658- (BOOL )isBare {
@@ -737,7 +741,9 @@ static int submoduleEnumerationCallback(git_submodule *git_submodule, const char
737741
738742 NSError *error;
739743 // Use -submoduleWithName:error: so that we get a git_submodule that we own.
740- GTSubmodule *submodule = [info->parentRepository submoduleWithName: @(name) error: &error];
744+ NSString *submoduleName = @(name);
745+ NSCAssert (submoduleName, @" submodule name is nil" );
746+ GTSubmodule *submodule = [info->parentRepository submoduleWithName: submoduleName error: &error];
741747
742748 BOOL stop = NO ;
743749 info->block (submodule, error, &stop);
0 commit comments