From mboxrd@z Thu Jan 1 00:00:00 1970 From: lfleischer at lfos.de (Lukas Fleischer) Date: Sun, 13 Dec 2015 01:27:13 +0100 Subject: [PATCH] Fix segmentation fault in hc() Message-ID: <1449966433-23375-1-git-send-email-lfleischer@lfos.de> 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 c04f380..6b78b91 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"; } -- 2.6.4