ls-files: don't try to prune an empty index
commit168e63554cbd965fee4d0092e02f8170eba7481f
authorRené Scharfe <l.s.r@web.de>
Sun, 16 Jul 2017 11:16:01 +0000 (16 13:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2017 21:55:21 +0000 (17 14:55 -0700)
tree4c8dab271a4d080f1ba05f91d3ce2d2b3d3ee7fb
parent177366415b95fb72bc2c37d55a936ff101986285
ls-files: don't try to prune an empty index

Exit early when asked to prune an index that contains no entries to
begin with.  This avoids pointer arithmetic on istate->cache, which is
possibly NULL in that case.

Found with Clang's UBSan.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c