revision.c: fix possible null pointer arithmetic

mark_tree_uninteresting() dereferences a tree pointer before
checking if the pointer is valid. Fix that by doing the check first.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Naewe 2015-12-05 16:27:24 +01:00 committed by Junio C Hamano
parent 24358560c3
commit a2678df335

View File

@ -131,10 +131,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
void mark_tree_uninteresting(struct tree *tree)
{
struct object *obj = &tree->object;
struct object *obj;
if (!tree)
return;
obj = &tree->object;
if (obj->flags & UNINTERESTING)
return;
obj->flags |= UNINTERESTING;