From: Lukas Fleischer Date: Sun, 13 Dec 2015 00:27:13 +0000 (+0100) Subject: Fix segmentation fault in hc() X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/da1b89710f5eb25297a66613ff3130b2a31cb86a 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 --- 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"; }