Hold state tracker lock for Me(). Fixes data race panic.

This commit is contained in:
Alex Bramley 2017-10-31 21:38:46 +00:00
parent c981f8f568
commit a7abc67ac2
1 changed files with 3 additions and 0 deletions

View File

@ -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()
}