mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-20 13:05:47 +00:00
diff_print: assert patch is non-NULL
When invoking `diff_print_info_init_frompatch` it is obvious that the patch should be non-NULL. We explicitly check if the variable is set and continue afterwards, happily dereferencing the potential NULL-pointer. Fix this by instead asserting that patch is set. This also silences Coverity.
This commit is contained in:
parent
bac52ab0f2
commit
be8479c987
@ -92,7 +92,11 @@ static int diff_print_info_init_frompatch(
|
||||
git_diff_line_cb cb,
|
||||
void *payload)
|
||||
{
|
||||
git_repository *repo = patch && patch->diff ? patch->diff->repo : NULL;
|
||||
git_repository *repo;
|
||||
|
||||
assert(patch);
|
||||
|
||||
repo = patch->diff ? patch->diff->repo : NULL;
|
||||
|
||||
memset(pi, 0, sizeof(diff_print_info));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user