mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 08:40:01 +00:00
Fix: Do not access automessage attributes without lock
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
ede8a95ed4
commit
1f09c0c0ee
1 changed files with 3 additions and 3 deletions
|
@ -35,13 +35,13 @@ type autoMessage struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *autoMessage) CanSend() bool {
|
func (a *autoMessage) CanSend() bool {
|
||||||
|
a.lock.RLock()
|
||||||
|
defer a.lock.RUnlock()
|
||||||
|
|
||||||
if a.disabled || !a.IsValid() {
|
if a.disabled || !a.IsValid() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
a.lock.RLock()
|
|
||||||
defer a.lock.RUnlock()
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case a.MessageInterval > a.linesSinceLastMessage:
|
case a.MessageInterval > a.linesSinceLastMessage:
|
||||||
// Not enough chatted lines
|
// Not enough chatted lines
|
||||||
|
|
Loading…
Reference in a new issue