From 814914ca19fd166c10df3fdfb8c1ea4438750068 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 10 Apr 2020 18:23:45 -0600 Subject: [PATCH] Fix json#Unmarshal when there are no servers --- api/server_endpoints.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/server_endpoints.go b/api/server_endpoints.go index 828f12f..d76bbd2 100644 --- a/api/server_endpoints.go +++ b/api/server_endpoints.go @@ -63,8 +63,11 @@ func (r *PanelRequest) GetAllServerConfigurations() (map[string]*ServerConfigura return nil, r.Error(), nil } - res := map[string]*ServerConfigurationResponse{} b, _ := r.ReadBody() + res := map[string]*ServerConfigurationResponse{} + if len(b) == 2 { + return res, nil, nil + } if err := json.Unmarshal(b, &res); err != nil { return nil, nil, errors.WithStack(err)