From 5511aaca5e42ade9cf96adf629bd0de6d1c1dfbb Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Thu, 6 May 2021 17:15:10 +0200 Subject: [PATCH] use len() to check if a slice is empty --- cron/handler.go | 2 +- discord/coords_translation.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cron/handler.go b/cron/handler.go index 0fa43d4..bfb98fc 100644 --- a/cron/handler.go +++ b/cron/handler.go @@ -290,7 +290,7 @@ func (h *handler) deleteClosedTWServers() { log.Errorln("deleteClosedTWServers: " + err.Error()) return } - if list == nil || list.Items == nil { + if list == nil || len(list.Items) <= 0 { return } diff --git a/discord/coords_translation.go b/discord/coords_translation.go index 7c99030..7260573 100644 --- a/discord/coords_translation.go +++ b/discord/coords_translation.go @@ -108,7 +108,7 @@ func (s *Session) translateCoords(ctx *commandCtx, m *discordgo.MessageCreate) { }, }, ) - if err != nil || list == nil || list.Items == nil { + if err != nil || list == nil || len(list.Items) <= 0 { return }