From ea7dc6b9d7797a220790e5ad82de7f7aca6f0fff Mon Sep 17 00:00:00 2001 From: dreamblack86 Date: Thu, 8 Jul 2021 16:38:02 +0200 Subject: [PATCH] Avoid null pointer exception for string interpolation --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e999016..480e089 100644 --- a/main.go +++ b/main.go @@ -41,7 +41,9 @@ type Handler struct { func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { code, msg, data, et, err := h.HandleRequest(h.App, w, r) if et != "" { - errLog.Printf("Error while processing request: %s", err) + if err != nil { + errLog.Printf("Error while processing request: %s", err) + } sendErrorEnvelope(w, code, msg, data, et) } else { sendEnvelope(w, code, msg, data)