X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/b608e88adb6f77328288afb6dd0eddf674fc9b5b..d2eb4fddb0fb7cd1751debcff6fe1219b9c619c8:/ui-patch.c diff --git a/ui-patch.c b/ui-patch.c index 68ebb15..c1c4ce3 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -8,6 +8,7 @@ #include "cgit.h" #include "html.h" +#include "ui-shared.h" static void print_line(char *line, int len) { @@ -89,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";