From 64b162e7e64b709da18d6050902b41c6a5ccd7a2 Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Wed, 15 Jun 2022 14:44:25 +0100 Subject: [PATCH] Fix verifyTeams if no teams exist --- app/http/endpoints/api/panel/panelcreate.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/http/endpoints/api/panel/panelcreate.go b/app/http/endpoints/api/panel/panelcreate.go index e1be8fe..f349f50 100644 --- a/app/http/endpoints/api/panel/panelcreate.go +++ b/app/http/endpoints/api/panel/panelcreate.go @@ -406,6 +406,12 @@ func (p *panelBody) verifyFormId(guildId uint64) (bool, error) { } func (p *panelBody) verifyTeams(guildId uint64) (bool, error) { + // Query does not work nicely if there are no teams created in the guild, but if the user submits no teams, + // then the input is guaranteed to be valid. + if len(p.Teams) == 0 { + return true, nil + } + return dbclient.Client.SupportTeam.AllTeamsExistForGuild(guildId, p.Teams) }