Return an empty IcecastStatus struct instead of nil in case of an error.
This commit is contained in:
parent
877b5d4013
commit
4cc4d0138a
@ -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{
|
||||||
|
Loading…
Reference in New Issue
Block a user