peel_onion: handle NULL
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>
Mon, 18 Feb 2008 20:47:58 +0000 (21:47 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Feb 2008 04:49:18 +0000 (20:49 -0800)
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c

index 4c0bc9c5b5d5257195ee676fe46d1d9129daf7e8..2575ea77f499f8316064c1c96927f391130946a7 100644 (file)
@@ -494,8 +494,11 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
                                return error("%.*s: expected %s type, but the object dereferences to %s type",
                                             len, name, typename(expected_type),
                                             typename(o->type));
+                       if (!o)
+                               return -1;
                        if (!o->parsed)
-                               parse_object(o->sha1);
+                               if (!parse_object(o->sha1))
+                                       return -1;
                }
        }
        return 0;