From a110cb86ed3d2c1356900aac9b4fbdaaa7fa123f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Tue, 19 Dec 2023 11:31:35 +0100 Subject: [PATCH] fix: bug when there's no host information, leading to a crash --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f2e8d49..8b07806 100644 --- a/main.go +++ b/main.go @@ -317,7 +317,11 @@ func main() { json.Unmarshal(body, &broadcastResponse) showCard.SetTitle(broadcastResponse.Broadcast.NextShow.Show.Name) date := broadcastResponse.Broadcast.NextShow.Day + " " + broadcastResponse.Broadcast.NextShow.Date - host := "by: " + broadcastResponse.Broadcast.NextShow.Show.Hosts[0].Name + host := "" + if len(broadcastResponse.Broadcast.NextShow.Show.Hosts) > 0 { + host = "by: " + broadcastResponse.Broadcast.NextShow.Show.Hosts[0].Name + } else { + } showCard.SetSubTitle(date + " " + host) showAvatar.Image = loadImageURL(broadcastResponse.Broadcast.NextShow.Show.AvatarUrl) showAvatar.Refresh()