]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-patch.c
Re-enable 'index-info' and add support for 'root-desc' in cgitrc
[ps-cgit] / ui-patch.c
index 36bfae4836df393cd1c24c94b58e15702e2bc134..c1c4ce30368d668b954d460a4df3b836da58db4f 100644 (file)
@@ -90,7 +90,11 @@ void cgit_print_patch(char *hex)
                return;
        }
        info = cgit_parse_commit(commit);
-       hashcpy(old_sha1, commit->parents->item->object.sha1);
+
+       if (commit->parents && commit->parents->item)
+               hashcpy(old_sha1, commit->parents->item->object.sha1);
+       else
+               hashclr(old_sha1);
 
        patchname = fmt("%s.patch", sha1_to_hex(sha1));
        ctx.page.mimetype = "text/plain";