From: Eric Wong Date: Wed, 6 Jul 2016 07:08:01 +0000 (+0000) Subject: ui-shared: fix segfault when defbranch is NULL X-Git-Tag: v1.1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=590ba455d694deaf2ec206510cf7f047ac365a96;p=cgit ui-shared: fix segfault when defbranch is NULL Not sure if there's a better fix for this. defbranch is NULL here on my setup when a crawler hit an invalid URL, causing strcmp to segfault. Signed-off-by: Eric Wong --- diff --git a/ui-shared.c b/ui-shared.c index b1a6c46..e39d004 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -253,7 +253,7 @@ static char *repolink(const char *title, const char *class, const char *page, } delim = "&"; } - if (head && strcmp(head, ctx.repo->defbranch)) { + if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) { html(delim); html("h="); html_url_arg(head);