Skip to content

Commit b87fc96

Browse files
committed
cache-tree.c::cache_tree_find(): simplify internal API
Earlier cache_tree_find() needs to be called with a valid cache_tree, but repeated look-up may find an invalid or missing cache_tree in between. Help simplify the callers by returning NULL to mean "nothing appropriate found" when the input is NULL. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d11b8d3 commit b87fc96

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cache-tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
514514

515515
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
516516
{
517+
if (!it)
518+
return NULL;
517519
while (*path) {
518520
const char *slash;
519521
struct cache_tree_sub *sub;

0 commit comments

Comments
 (0)