1
0

Return an empty IcecastStatus struct instead of nil in case of an error.

This commit is contained in:
Alexander Andreev 2023-07-22 23:08:18 +04:00
parent 877b5d4013
commit 4cc4d0138a
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -61,13 +61,13 @@ type Song struct {
func IcecastGetStatus(icecastURL string) (*IcecastStatus, error) { func IcecastGetStatus(icecastURL string) (*IcecastStatus, error) {
resp, err := http.Get(icecastURL) resp, err := http.Get(icecastURL)
if err != nil { if err != nil {
return nil, err return &IcecastStatus{}, err
} }
iceStatDTO := &IcecastStatusDTO{} iceStatDTO := &IcecastStatusDTO{}
if err := json.NewDecoder(resp.Body).Decode(iceStatDTO); err != nil { if err := json.NewDecoder(resp.Body).Decode(iceStatDTO); err != nil {
return nil, err return &IcecastStatus{}, err
} }
return &IcecastStatus{ return &IcecastStatus{