summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2015-01-25 14:40:23 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-21 21:12:08 +0100
commit5c3e01d89172cd5f3bad6bbf7151556f44ac2dba (patch)
treedd8299caebb3e9bbc33c28d9586516f3bc677309
parentfe61bb68d07a27cd798f2cb6c1334bbdad4f4b4b (diff)
downloadlibgit2-5c3e01d89172cd5f3bad6bbf7151556f44ac2dba.tar.gz
Ensure the diff hunk callback is specified before trying to dereference it
-rw-r--r--src/diff_patch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c
index 317dbeabb..7cdf6f39b 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -822,7 +822,8 @@ int git_patch__invoke_callbacks(
for (i = 0; !error && i < git_array_size(patch->hunks); ++i) {
diff_patch_hunk *h = git_array_get(patch->hunks, i);
- error = hunk_cb(patch->delta, &h->hunk, payload);
+ if (hunk_cb)
+ error = hunk_cb(patch->delta, &h->hunk, payload);
if (!line_cb)
continue;