diff options
author | Lars Hjemli <hjemli@gmail.com> | 2008-07-27 14:32:08 +0400 |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-07-27 14:32:08 +0400 |
commit | 25c84326deff579d5de4b880f9dca2690bdc8569 (patch) | |
tree | 9ca41073e0e06e6dc24f7800182bf4a7b22f548c /ui-shared.c | |
parent | 2d6ee032d0c2f84ebcfaa12d3289e85cfab18fcd (diff) |
Be prepared for empty repositories
Before this patch, cgit would segfault on repositories with no refs.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c index 209af6e..4280a70 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -518,7 +518,8 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) html_hidden("url", url); } - if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) + if (incl_head && ctx.qry.head && ctx.repo->defbranch && + strcmp(ctx.qry.head, ctx.repo->defbranch)) html_hidden("h", ctx.qry.head); if (ctx.qry.sha1) |