diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-01 21:37:32 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-01 21:37:32 -0400 |
commit | dd58402ef35ef8971920810768b87717c2a2169d (patch) | |
tree | 9d6f020a9b606c0f1196f3ee8b61d4280b5360c5 /git-access.c | |
parent | a51903fbb66a32b996e37e38b5634d74358a3330 (diff) | |
download | subsurface-dd58402ef35ef8971920810768b87717c2a2169d.tar.gz |
Avoid possible NULL dereference
I actually think this might be a false positive, but the libgit2 API
doesn't appear to guarantee that ancestor is not NULL, so let's add that
check.
Coverity CID 1325296
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'git-access.c')
-rw-r--r-- | git-access.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/git-access.c b/git-access.c index d78aa0629..25f1d9e8a 100644 --- a/git-access.c +++ b/git-access.c @@ -329,7 +329,7 @@ static int try_to_git_merge(git_repository *repo, git_reference *local, git_refe // the file was removed on one side or the other - just remove it fprintf(stderr, "looks like a delete on one side; removing the file from the index\n"); error = git_index_remove(merged_index, ours ? ours->path : theirs->path, GIT_INDEX_STAGE_ANY); - } else { + } else if (ancestor) { error = git_index_conflict_remove(merged_index, ours ? ours->path : theirs ? theirs->path : ancestor->path); } if (error) { |