From 4926b04aedac9cf1f32ef1d0e6b307ad54fe2fa4 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 22 Oct 2022 19:24:13 +0200 Subject: [PATCH] Check not nil --- ws/dial.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ws/dial.go b/ws/dial.go index 4234cad..575c7b3 100644 --- a/ws/dial.go +++ b/ws/dial.go @@ -72,6 +72,9 @@ func (e *dialErr) Error() string { func (e *dialErr) Unwrap() error { return e.error } func mdFromContext(ctx context.Context) metadata.MD { + if ctx == nil { + return nil + } md, _ := metadata.FromOutgoingContext(ctx) return md }