mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-28 17:53:30 +00:00
state: Fix Messages() OOB panic
This commit is contained in:
parent
ec4cd6d661
commit
34db90a16d
|
@ -603,7 +603,7 @@ func (s *State) Message(
|
|||
// first. The returned slice will be sorted from latest to oldest.
|
||||
func (s *State) Messages(channelID discord.ChannelID, limit uint) ([]discord.Message, error) {
|
||||
storeMessages, err := s.Cabinet.Messages(channelID)
|
||||
if err == nil && s.tracksMessage(&storeMessages[0]) {
|
||||
if len(storeMessages) > 0 && s.tracksMessage(&storeMessages[0]) {
|
||||
// Is the channel tiny?
|
||||
s.fewMutex.Lock()
|
||||
if _, ok := s.fewMessages[channelID]; ok {
|
||||
|
|
Loading…
Reference in a new issue