From d09e2cd5516473753cb067e723293fab180e0b1b Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Sun, 5 Oct 2008 06:14:40 +0400 Subject: do not segfault if make_cache_entry failed Signed-off-by: Dmitry Potapov Signed-off-by: Shawn O. Pearce --- builtin-reset.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin-reset.c') diff --git a/builtin-reset.c b/builtin-reset.c index c24c219091..16e6bb20f1 100644 --- a/builtin-reset.c +++ b/builtin-reset.c @@ -121,6 +121,9 @@ static void update_index_from_diff(struct diff_queue_struct *q, struct cache_entry *ce; ce = make_cache_entry(one->mode, one->sha1, one->path, 0, 0); + if (!ce) + die("make_cache_entry failed for path '%s'", + one->path); add_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE); } else -- cgit v1.2.3