summaryrefslogtreecommitdiff
path: root/t/t4013/diff.show_initial
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2017-10-05 21:41:26 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-10-06 11:04:34 +0900
commit2720f6db5d35fece41190b93a1eba76d2f64f490 (patch)
tree6eb26195ed0af37c0b394ab07b48e8cbb42cd14f /t/t4013/diff.show_initial
parentGit 2.14.2 (diff)
downloadtgif-2720f6db5d35fece41190b93a1eba76d2f64f490.tar.xz
fsck: handle NULL return of lookup_blob() and lookup_tree()
lookup_blob() and lookup_tree() can return NULL if they find an object of an unexpected type. Accessing the object member is undefined in that case. Cast the result to a struct object pointer instead; we can do that because object is the first member of all object types. This trick is already used in other places in the code. An error message is already shown by object_as_type(), which is called by the lookup functions. The walk callback functions are expected to handle NULL object pointers passed to them, but put_object_name() needs a valid object, so avoid calling it without one. Suggested-by: SZEDER Gábor <szeder.dev@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.show_initial')
0 files changed, 0 insertions, 0 deletions