about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJune McEnroe2021-04-12 21:18:42 +0000
committerJune McEnroe2022-02-13 11:57:33 -0500
commit12d91b897df65a2a50878edc62541c5b7f90003a (patch)
treef8be70da5e3c7d0642cdc43f87a9bbf3761a7d60
parentUse owner-filter for repo page headers (diff)
downloadcgit-12d91b897df65a2a50878edc62541c5b7f90003a.tar.gz
cgit-12d91b897df65a2a50878edc62541c5b7f90003a.zip
Fix crash trying to print "this commit" on 404s
For example any URL that starts with a real repo name but isn't
valid.
-rw-r--r--ui-shared.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c index 1858ea4..09c4c94 100644 --- a/ui-shared.c +++ b/ui-shared.c
@@ -896,7 +896,7 @@ void cgit_add_clone_urls(void (*fn)(const char *))
896static int print_this_commit_option(void) 896static int print_this_commit_option(void)
897{ 897{
898 struct object_id oid; 898 struct object_id oid;
899 if (get_oid(ctx.qry.head, &oid)) 899 if (!ctx.qry.head || get_oid(ctx.qry.head, &oid))
900 return 1; 900 return 1;
901 html_option(oid_to_hex(&oid), "this commit", ctx.qry.head); 901 html_option(oid_to_hex(&oid), "this commit", ctx.qry.head);
902 return 0; 902 return 0;