From bb6aafe88f01d2902085fd78464ae277ebea0a67 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sun, 25 Jan 2015 14:40:23 +0200 Subject: [PATCH] Ensure the diff hunk callback is specified before trying to dereference it --- src/diff_patch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;