From 8f5730de4d4e7a2be37ba335ab40b9fd32740f73 Mon Sep 17 00:00:00 2001 From: Dan Leehr Date: Tue, 2 Jun 2015 10:26:30 -0400 Subject: [PATCH 1/2] Avoid calling tag enumerator block if lookup returns nil tag Otherwise, the tag enumerator block can be called with a nil GTTag, leading to an exception when allTagsWithError adds it to tagArray. --- ObjectiveGit/GTRepository.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index c9f3d6b9b..44135a215 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -457,7 +457,9 @@ static int GTRepositoryForeachTagCallback(const char *name, git_oid *oid, void * GTTag *tag = (GTTag *)[info->myself lookUpObjectByGitOid:oid objectType:GTObjectTypeTag error:NULL]; BOOL stop = NO; - info->block(tag, &stop); + if (tag) { + info->block(tag, &stop); + } return stop ? GIT_EUSER : 0; } From 4f29c2b63de836a8ddf8263c27f80018d91b3d0c Mon Sep 17 00:00:00 2001 From: Dan Leehr Date: Tue, 2 Jun 2015 11:50:05 -0400 Subject: [PATCH 2/2] Explicitly compare tag to nil, per style recommendation --- ObjectiveGit/GTRepository.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 44135a215..999896050 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -457,7 +457,7 @@ static int GTRepositoryForeachTagCallback(const char *name, git_oid *oid, void * GTTag *tag = (GTTag *)[info->myself lookUpObjectByGitOid:oid objectType:GTObjectTypeTag error:NULL]; BOOL stop = NO; - if (tag) { + if (tag != nil) { info->block(tag, &stop); }