From add6c3994bdc86f329df2b16c5f8a36b29623d0f Mon Sep 17 00:00:00 2001 From: Belyakov Sergey Date: Mon, 1 Aug 2022 12:02:03 +0700 Subject: [PATCH] Update js.go fix nil pointer dereference when jsi is not inited --- js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js.go b/js.go index 5ea6c9fb9..fc2fd480c 100644 --- a/js.go +++ b/js.go @@ -2466,7 +2466,7 @@ func ConsumerReplicas(replicas int) SubOpt { func (sub *Subscription) ConsumerInfo() (*ConsumerInfo, error) { sub.mu.Lock() // TODO(dlc) - Better way to mark especially if we attach. - if sub.jsi.consumer == _EMPTY_ { + if sub.jsi == nil || sub.jsi.consumer == _EMPTY_ { sub.mu.Unlock() return nil, ErrTypeSubscription }