Fix json#Unmarshal when there are no servers

This commit is contained in:
Matthew Penner 2020-04-10 18:23:45 -06:00
parent 1f4aca8210
commit 814914ca19

View File

@ -63,8 +63,11 @@ func (r *PanelRequest) GetAllServerConfigurations() (map[string]*ServerConfigura
return nil, r.Error(), nil return nil, r.Error(), nil
} }
res := map[string]*ServerConfigurationResponse{}
b, _ := r.ReadBody() b, _ := r.ReadBody()
res := map[string]*ServerConfigurationResponse{}
if len(b) == 2 {
return res, nil, nil
}
if err := json.Unmarshal(b, &res); err != nil { if err := json.Unmarshal(b, &res); err != nil {
return nil, nil, errors.WithStack(err) return nil, nil, errors.WithStack(err)