]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-shared: fix segfault when defbranch is NULL
authorEric Wong <normalperson@yhbt.net>
Wed, 6 Jul 2016 07:08:01 +0000 (07:08 +0000)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 6 Jul 2016 09:29:23 +0000 (11:29 +0200)
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 <normalperson@yhbt.net>
ui-shared.c

index b1a6c46be57f18576d3c1a57008029382f2417cb..e39d004e5d74019a26a642d5e04443936fe6769b 100644 (file)
@@ -253,7 +253,7 @@ static char *repolink(const char *title, const char *class, const char *page,
                }
                delim = "&amp;";
        }
-       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);