Skip to content

Commit

Permalink
[Fixed] Check if nats connection is nil in Drain()
Browse files Browse the repository at this point in the history
Resolves nats-io#1562
  • Loading branch information
mrazimi99 committed Feb 24, 2024
1 parent f7c1fe9 commit 7b2ac25
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nats.go
Expand Up @@ -5314,6 +5314,9 @@ func (nc *Conn) drainConnection() {
//
// See note in Subscription.Drain for JetStream subscriptions.
func (nc *Conn) Drain() error {
if nc == nil {
return ErrInvalidConnection
}
nc.mu.Lock()
if nc.isClosed() {
nc.mu.Unlock()
Expand Down

0 comments on commit 7b2ac25

Please sign in to comment.