]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-patch.c
More layout fixes
[ps-cgit] / ui-patch.c
index 68ebb152781bb1352c0003d2ae87f64c2537a7b9..c1c4ce30368d668b954d460a4df3b836da58db4f 100644 (file)
@@ -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";