Modify GuildEdit bounds check

This commit is contained in:
Julian Y 2019-08-04 01:28:49 -07:00 committed by GitHub
parent 8d8906ce4b
commit 792b209680
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -617,10 +617,10 @@ func (s *Session) GuildCreate(name string) (st *Guild, err error) {
// g : A GuildParams struct with the values Name, Region and VerificationLevel defined. // g : A GuildParams struct with the values Name, Region and VerificationLevel defined.
func (s *Session) GuildEdit(guildID string, g GuildParams) (st *Guild, err error) { func (s *Session) GuildEdit(guildID string, g GuildParams) (st *Guild, err error) {
// Bounds checking for VerificationLevel, interval: [0, 3] // Bounds checking for VerificationLevel, interval: [0, 4]
if g.VerificationLevel != nil { if g.VerificationLevel != nil {
val := *g.VerificationLevel val := *g.VerificationLevel
if val < 0 || val > 3 { if val < 0 || val > 4 {
err = ErrVerificationLevelBounds err = ErrVerificationLevelBounds
return return
} }