diff --git a/relay/client/dialer/ws/ws.go b/relay/client/dialer/ws/ws.go index d53ced58e..ccdfe2d9c 100644 --- a/relay/client/dialer/ws/ws.go +++ b/relay/client/dialer/ws/ws.go @@ -28,8 +28,9 @@ func Dial(address string) (net.Conn, error) { log.Errorf("failed to dial to Relay server '%s': %s", wsURL, err) return nil, err } - _ = resp.Body.Close() - + if resp.Body != nil { + _ = resp.Body.Close() + } conn := NewConn(wsConn) return conn, nil }