mirror of https://github.com/fluffle/goirc
Hold state tracker lock for Me(). Fixes data race panic.
This commit is contained in:
parent
c981f8f568
commit
a7abc67ac2
|
@ -266,7 +266,10 @@ func (st *stateTracker) ChannelModes(c, modes string, args ...string) *Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the Nick the state tracker thinks is Me.
|
// Returns the Nick the state tracker thinks is Me.
|
||||||
|
// NOTE: Nick() requires the mutex to be held.
|
||||||
func (st *stateTracker) Me() *Nick {
|
func (st *stateTracker) Me() *Nick {
|
||||||
|
st.mu.Lock()
|
||||||
|
defer st.mu.Unlock()
|
||||||
return st.me.Nick()
|
return st.me.Nick()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue