Skip to content

Unknown component type - panic on access #1683

@Mxrk

Description

@Mxrk

Hi,

Discord "released" a new component type (20) for checkpoints without being listed on https://discord.com/developers/docs/components/reference#component-object-component-types

discordgo/components.go

Lines 77 to 80 in 22e5cd8

default:
return fmt.Errorf("unknown component type: %d", v.Type)
}
return json.Unmarshal(src, umc.MessageComponent)

Because of the error handling here, it's currently simply returning an error which isn't stopping handlers to work with the event.
That means accessing the event in your handler does end in a panic:

wsapi.go:661:onEvent() error unmarshalling MESSAGE_CREATE event, unknown component type: 20"}
panic: runtime error: invalid memory address or nil pointer dereference

Guess simply removing the return err would fix the problem(?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions