Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Nov 2, 2021
1 parent de6fae5 commit 0e3acf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions protocols/smux/smux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type sMux struct {
}

func (m *sMux) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
m.mux.Lock()
defer m.mux.Unlock()
if m.sess == nil || m.sess.IsClosed() {
if m.sess != nil {
m.sess.Close()
Expand Down

0 comments on commit 0e3acf1

Please sign in to comment.