summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-diff.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui-diff.c b/ui-diff.c
index a7bc667..d21541b 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -346,6 +346,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
}
commit = lookup_commit_reference(new_rev_sha1);
- if (!commit || parse_commit(commit))
+ if (!commit || parse_commit(commit)) {
cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1)));
+ return;
+ }
if (old_rev)
@@ -363,6 +365,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
}
commit2 = lookup_commit_reference(old_rev_sha1);
- if (!commit2 || parse_commit(commit2))
+ if (!commit2 || parse_commit(commit2)) {
cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(old_rev_sha1)));
+ return;
+ }
}