From 48c52c9f8160d91e7aa906c07c06b502a26ac737 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Mon, 6 Dec 2021 11:32:17 +0000
Subject: [PATCH] Fix an error when the Config is nil

---
 serverutil/http.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/serverutil/http.go b/serverutil/http.go
index 6a2cc3d..b257535 100644
--- a/serverutil/http.go
+++ b/serverutil/http.go
@@ -89,7 +89,7 @@ func (config *ServerConfig) buildHTTPHandler(h http.Handler) (http.Handler, *tls
 	h = addDefaultHandlers(h)
 
 	// Optionally enable compression.
-	if config.EnableCompression {
+	if config != nil && config.EnableCompression {
 		gzwrap, err := gziphandler.GzipHandlerWithOpts(
 			gziphandler.CompressionLevel(gzipLevel),
 			gziphandler.MinSize(gzipMinSize),
-- 
GitLab