Fixed randomOldMsg out of bounds

This commit is contained in:
diamondburned (Forefront) 2020-06-12 17:34:44 -07:00
parent b37eee0bea
commit b36f8f47de
1 changed files with 1 additions and 1 deletions

View File

@ -255,7 +255,7 @@ func (ch *Channel) randomOldMsg() Message {
defer ch.messageMutex.Unlock()
// Pick a random index from last, clamped to 10 and len channel.
n := len(ch.messageids) - rand.Intn(len(ch.messageids))%10
n := len(ch.messageids) - 1 - rand.Intn(len(ch.messageids))%10
return ch.messages[ch.messageids[n]]
}