From 6f3716dc22e373097a38d053f5415feca602f330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 22 Oct 2018 19:50:27 +0200 Subject: [PATCH] commands: Avoid panic in error handler on config errors --- commands/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/server.go b/commands/server.go index 7b7164eea..58d1a60fb 100644 --- a/commands/server.go +++ b/commands/server.go @@ -334,7 +334,11 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro if err != nil { f.c.logger.ERROR.Println(err) } - fmt.Fprint(w, injectLiveReloadScript(&b, f.c.Cfg.GetInt("liveReloadPort"))) + port = 1313 + if !f.c.paused { + port = f.c.Cfg.GetInt("liveReloadPort") + } + fmt.Fprint(w, injectLiveReloadScript(&b, port)) return }