diff --git a/waku/v2/protocol/filter/client.go b/waku/v2/protocol/filter/client.go index 6f59c655..f2787269 100644 --- a/waku/v2/protocol/filter/client.go +++ b/waku/v2/protocol/filter/client.go @@ -379,7 +379,7 @@ func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter Co localWg.Wait() close(resultChan) for _, peerID := range peersUnsubscribed { - if len(wf.subscriptions.items[peerID].subscriptionsPerTopic) == 0 { + if wf.subscriptions != nil && wf.subscriptions.items != nil && wf.subscriptions.items[peerID] != nil && len(wf.subscriptions.items[peerID].subscriptionsPerTopic) == 0 { delete(wf.subscriptions.items, peerID) } }