Skip to content

Commit

Permalink
[client] Avoid panic when there is no conn client (#2541)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon authored Sep 5, 2024
1 parent f2b5b2e commit bdbd1db
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/internal/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}

Expand Down

0 comments on commit bdbd1db

Please sign in to comment.