diff options
author | Lukas Fleischer | 2015-12-13 01:27:13 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2016-01-13 17:14:01 +0100 |
commit | da1b89710f5eb25297a66613ff3130b2a31cb86a (patch) | |
tree | 75f0b942c7e46061c4f1e1096c7b185655aef2dc /ui-shared.c | |
parent | 559ab5ecc4445c8477ecf62c9fc97efa412dd562 (diff) | |
download | cgit-da1b89710f5eb25297a66613ff3130b2a31cb86a.tar.gz cgit-da1b89710f5eb25297a66613ff3130b2a31cb86a.tar.bz2 cgit-da1b89710f5eb25297a66613ff3130b2a31cb86a.zip |
Fix segmentation fault in hc()
The ctx.qry.page variable might be unset at this point, e.g. when an
invalid command is passed and cgit_print_pageheader() is called to show
an error message.
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 48358cc..5b48734 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -889,6 +889,9 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, | |||
889 | 889 | ||
890 | static const char *hc(const char *page) | 890 | static const char *hc(const char *page) |
891 | { | 891 | { |
892 | if (!ctx.qry.page) | ||
893 | return NULL; | ||
894 | |||
892 | return strcmp(ctx.qry.page, page) ? NULL : "active"; | 895 | return strcmp(ctx.qry.page, page) ? NULL : "active"; |
893 | } | 896 | } |
894 | 897 | ||