From da1b89710f5eb25297a66613ff3130b2a31cb86a Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 13 Dec 2015 01:27:13 +0100 Subject: 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 --- ui-shared.c | 3 +++ 1 file changed, 3 insertions(+) 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, static const char *hc(const char *page) { + if (!ctx.qry.page) + return NULL; + return strcmp(ctx.qry.page, page) ? NULL : "active"; } -- cgit v1.2.3-24-g4f1b