[client] Prevent panic on nil connection during Close

This commit is contained in:
Zoltán Papp
2026-04-01 11:36:48 +02:00
parent 8460c3f375
commit 297546e714

View File

@@ -88,6 +88,10 @@ func (c *GRPCClient) Close() error {
c.clientConn = nil
c.mu.Unlock()
if conn == nil {
return nil
}
if err := conn.Close(); err != nil && !errors.Is(err, context.Canceled) {
return fmt.Errorf("close client connection: %w", err)
}