summaryrefslogtreecommitdiff
path: root/src/diff_patch.c
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2015-01-25 14:40:23 +0200
committerJacques Germishuys <jacquesg@striata.com>2015-01-25 14:40:23 +0200
commitbb6aafe88f01d2902085fd78464ae277ebea0a67 (patch)
tree62e4be12cb963b8ee34dc443e3f33fc8019f0f3f /src/diff_patch.c
parent636af2198e7d9128d6bf49cd7f7119de62fd5975 (diff)
downloadlibgit2-bb6aafe88f01d2902085fd78464ae277ebea0a67.tar.gz
Ensure the diff hunk callback is specified before trying to dereference it
Diffstat (limited to 'src/diff_patch.c')
-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 3129d06e1..a15107753 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -823,7 +823,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;