From 30a220075001db2174b5b92a1eec79c89d034db8 Mon Sep 17 00:00:00 2001 From: 3andne <52860475+3andne@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:17:43 -0700 Subject: [PATCH] fix: don't deref nil ptr (#214) --- u_parrots.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/u_parrots.go b/u_parrots.go index 4658d682..7e2660f9 100644 --- a/u_parrots.go +++ b/u_parrots.go @@ -2092,7 +2092,9 @@ func (uconn *UConn) ApplyPreset(p *ClientHelloSpec) error { if session == nil && uconn.config.ClientSessionCache != nil { cacheKey := uconn.clientSessionCacheKey() cs, _ = uconn.config.ClientSessionCache.Get(cacheKey) - session = cs.session + if cs != nil { + session = cs.session + } // TODO: use uconn.loadSession(hello.getPrivateObj()) to support TLS 1.3 PSK-style resumption } err := uconn.SetSessionState(cs)