Don't die or it'll upset t5303's recovery action by repacking from
loose objects

Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 packv4-parse.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/packv4-parse.c b/packv4-parse.c
index e833cd2..88b7aa1 100644
--- a/packv4-parse.c
+++ b/packv4-parse.c
@@ -18,13 +18,18 @@ const unsigned char *get_sha1ref(struct packed_git *p,
 {
        const unsigned char *sha1;
 
+       if (!p->sha1_table)
+               return NULL;
+
        if (!**bufp) {
                sha1 = *bufp + 1;
                *bufp += 21;
        } else {
                unsigned int index = decode_varint(bufp);
-               if (index < 1 || index - 1 > p->num_objects)
-                       die("bad index in %s", __func__);
+               if (index < 1 || index - 1 > p->num_objects) {
+                       error("bad index in get_sha1ref");
+                       return NULL;
+               }
                sha1 = p->sha1_table + (index - 1) * 20;
        }
 
-- 
1.8.2.83.gc99314b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to