diffcore-break.c: check diff_delta() return value.
authorJunio C Hamano <junio@twinsun.com>
Mon, 12 Dec 2005 20:50:40 +0000 (12:50 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 12 Dec 2005 20:57:25 +0000 (12:57 -0800)
This bug caused Darrin Thompson to notice that our deltifier was
half broken and punting on an empty blob.

Signed-off-by: Junio C Hamano <junio@twinsun.com>
diffcore-break.c

index 06f9a7f..e6a468e 100644 (file)
@@ -66,6 +66,8 @@ static int should_break(struct diff_filespec *src,
        delta = diff_delta(src->data, src->size,
                           dst->data, dst->size,
                           &delta_size, 0);
+       if (!delta)
+               return 0; /* error but caught downstream */
 
        /* Estimate the edit size by interpreting delta. */
        if (count_delta(delta, delta_size,