From bdbd1db843397082447342f86b9ee10223bef8b8 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Thu, 5 Sep 2024 15:09:46 +0200 Subject: [PATCH] [client] Avoid panic when there is no conn client (#2541) --- client/internal/connect.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/internal/connect.go b/client/internal/connect.go index 6e1994f9662..5dacde74676 100644 --- a/client/internal/connect.go +++ b/client/internal/connect.go @@ -297,6 +297,9 @@ func (c *ConnectClient) run( } func (c *ConnectClient) Engine() *Engine { + if c == nil { + return nil + } var e *Engine c.engineMutex.Lock() e = c.engine @@ -305,8 +308,15 @@ func (c *ConnectClient) Engine() *Engine { } func (c *ConnectClient) Stop() error { + if c == nil { + return nil + } c.engineMutex.Lock() defer c.engineMutex.Unlock() + + if c.engine == nil { + return nil + } return c.engine.Stop() }