From a7abc67ac229ff40f2b09dbb4851585d99ec1aca Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Tue, 31 Oct 2017 21:38:46 +0000 Subject: [PATCH] Hold state tracker lock for Me(). Fixes data race panic. --- state/tracker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/state/tracker.go b/state/tracker.go index 686fedc..209c7cf 100644 --- a/state/tracker.go +++ b/state/tracker.go @@ -266,7 +266,10 @@ func (st *stateTracker) ChannelModes(c, modes string, args ...string) *Channel { } // Returns the Nick the state tracker thinks is Me. +// NOTE: Nick() requires the mutex to be held. func (st *stateTracker) Me() *Nick { + st.mu.Lock() + defer st.mu.Unlock() return st.me.Nick() }