Fix potential send-pack SIGSEGV
[gitweb.git] / send-pack.c
index 2a7ab2d2b9428adcbe740390e78f164b462bb717..9b4be6130cad815384a3116be82af1264b9e286f 100644 (file)
@@ -134,7 +134,8 @@ static int ref_newer(const unsigned char *new_sha1, const unsigned char *old_sha
                return 0;
        list = NULL;
        commit_list_insert(new, &list);
-       while ((new = pop_most_recent_commit(&list, 1)) != NULL) {
+       while (list) {
+               new = pop_most_recent_commit(&list, 1);
                if (new == old)
                        return 1;
        }