From 13babc7958704700b564d39a427a17c51f7c0641 Mon Sep 17 00:00:00 2001 From: Phillip Moore Date: Thu, 3 Jul 2014 10:09:16 -0500 Subject: [PATCH] Fix nill/null value of IPList Initialize IPList to an empty array if the IPList is nil/null. --- jail.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jail.go b/jail.go index 1474494..63b4b44 100644 --- a/jail.go +++ b/jail.go @@ -14,6 +14,11 @@ func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fai useDNS, _ := fail2goConn.JailUseDNS(mux.Vars(req)["jail"]) maxRetry, _ := fail2goConn.JailMaxRetry(mux.Vars(req)["jail"]) + //If IPList is nil/null/doesn't exist, then initialize it to an empty string array. This resolves the front end issue where a null value is trying to be parsed for the ips. + if IPList == nil { + IPList = []string{} + } + encodedOutput, err := json.Marshal(map[string]interface{}{ "currentlyFailed": currentlyFailed, "totalFailed": totalFailed,