Fix: Do not access automessage attributes without lock

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-06-11 14:02:43 +02:00
parent ede8a95ed4
commit 1f09c0c0ee
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -35,13 +35,13 @@ type autoMessage struct {
}
func (a *autoMessage) CanSend() bool {
a.lock.RLock()
defer a.lock.RUnlock()
if a.disabled || !a.IsValid() {
return false
}
a.lock.RLock()
defer a.lock.RUnlock()
switch {
case a.MessageInterval > a.linesSinceLastMessage:
// Not enough chatted lines