Ensure the diff hunk callback is specified before trying to dereference it

This commit is contained in:
Jacques Germishuys 2015-01-25 14:40:23 +02:00
parent 636af2198e
commit bb6aafe88f

View File

@ -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;