Fix null pointer derefernce in validateColor

This commit is contained in:
Ryan Cavicchioni 2021-04-18 15:41:14 +00:00
parent 2107a05864
commit 41b730d33d
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"
)
@ -201,7 +200,6 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
var (
err error
s *HSBKColor
r *http.Response
resp *Response
)
@ -209,11 +207,6 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
return nil, err
}
resp, err = NewResponse(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if err = json.NewDecoder(resp.Body).Decode(&s); err != nil {