X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=commit.c;h=edd4dedcdd13c2c3fd02714ef282b173f7cec7fe;hb=975b31dc6e12fba8f7b067ddbe32230995e05400;hp=e867b86e6a10d64354226b04f71df98d7448e072;hpb=4a4e6fd74f7d4564ed43eaaf59b6bd70c1959f1a;p=git.git diff --git a/commit.c b/commit.c index e867b86e..edd4dedc 100644 --- a/commit.c +++ b/commit.c @@ -560,6 +560,9 @@ void sort_in_topological_order(struct commit_list ** list) next = next->next; count++; } + + if (!count) + return; /* allocate an array to help sort the list */ nodes = xcalloc(count, sizeof(*nodes)); /* link the list to the array */