diff options
author | Eric Wong | 2016-07-06 07:08:01 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2016-07-06 11:29:23 +0200 |
commit | 590ba455d694deaf2ec206510cf7f047ac365a96 (patch) | |
tree | bfea40b66089cba4bd2f2120eb35725aae6b5531 | |
parent | c19d983ed7b86face56e41effea4fffcf9ad1e19 (diff) | |
download | cgit-590ba455d694deaf2ec206510cf7f047ac365a96.tar.gz cgit-590ba455d694deaf2ec206510cf7f047ac365a96.tar.bz2 cgit-590ba455d694deaf2ec206510cf7f047ac365a96.zip |
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 <normalperson@yhbt.net>
-rw-r--r-- | ui-shared.c | 2 |
1 files changed, 1 insertions, 1 deletions
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, | |||
253 | } | 253 | } |
254 | delim = "&"; | 254 | delim = "&"; |
255 | } | 255 | } |
256 | if (head && strcmp(head, ctx.repo->defbranch)) { | 256 | if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) { |
257 | html(delim); | 257 | html(delim); |
258 | html("h="); | 258 | html("h="); |
259 | html_url_arg(head); | 259 | html_url_arg(head); |