fix: bug when there's no host information, leading to a crash

This commit is contained in:
José Carlos Cuevas 2023-12-19 11:31:35 +01:00
parent d69dd19a0c
commit a110cb86ed

View file

@ -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()