diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go index edc8ab4..23cb3e1 100644 --- a/client/lib/webrtc.go +++ b/client/lib/webrtc.go @@ -236,7 +236,9 @@ func exchangeSDP(broker *BrokerChannel, offer *webrtc.SessionDescription) *webrt // Close all channels and transports func (c *WebRTCPeer) cleanup() { // Close this side of the SOCKS pipe. - c.writePipe.Close() + if c.writePipe != nil { // c.writePipe can be nil in tests. + c.writePipe.Close() + } if nil != c.transport { log.Printf("WebRTC: closing DataChannel") c.transport.Close()