mirror of
https://github.com/Sean-Der/fail2rest.git
synced 2024-12-22 13:42:17 +01:00
Fix nill/null value of IPList
Initialize IPList to an empty array if the IPList is nil/null.
This commit is contained in:
parent
e981bb0d73
commit
13babc7958
1 changed files with 5 additions and 0 deletions
5
jail.go
5
jail.go
|
@ -14,6 +14,11 @@ func jailGetHandler(res http.ResponseWriter, req *http.Request, fail2goConn *fai
|
||||||
useDNS, _ := fail2goConn.JailUseDNS(mux.Vars(req)["jail"])
|
useDNS, _ := fail2goConn.JailUseDNS(mux.Vars(req)["jail"])
|
||||||
maxRetry, _ := fail2goConn.JailMaxRetry(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{}{
|
encodedOutput, err := json.Marshal(map[string]interface{}{
|
||||||
"currentlyFailed": currentlyFailed,
|
"currentlyFailed": currentlyFailed,
|
||||||
"totalFailed": totalFailed,
|
"totalFailed": totalFailed,
|
||||||
|
|
Loading…
Reference in a new issue