Fix: Only access slice if it has content

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-12-06 19:00:57 +01:00
parent 159edd485e
commit b5d908d2e2
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -120,7 +120,10 @@ func (m modStreamSchedule) cronUpdateSchedule() {
}
if managedMsg != nil {
oldEmbed := managedMsg.Embeds[0]
var oldEmbed *discordgo.MessageEmbed
if len(managedMsg.Embeds) > 0 {
oldEmbed = managedMsg.Embeds[0]
}
if isDiscordMessageEmbedEqual(oldEmbed, msgEmbed) && strings.TrimSpace(managedMsg.Content) == strings.TrimSpace(contentString) {
log.Debug("Stream Schedule is up-to-date")