Skip to content

Commit 0bb63b6

Browse files
committed
fix: Crash on uninitialized filterManager
Not sure if this will only hide the root cause because the proper flow on pairing is unknown to me. But from what I've seen Waku is only started after login. While `subscribe` and `unsubscribe` is used in the pairing flow as well.
1 parent c3bd89f commit 0bb63b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

messaging/waku/gowaku.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,9 @@ func (w *Waku) subscribe(f *common.Filter) (string, error) {
968968
}
969969

970970
if w.cfg.LightClient {
971+
if w.filterManager == nil {
972+
return id, nil
973+
}
971974
cf := protocol.NewContentFilter(f.PubsubTopic, f.ContentTopics.ContentTopics()...)
972975
w.filterManager.SubscribeFilter(id, cf)
973976
}
@@ -983,6 +986,9 @@ func (w *Waku) Unsubscribe(ctx context.Context, id string) error {
983986
}
984987

985988
if w.cfg.LightClient {
989+
if w.filterManager == nil {
990+
return nil
991+
}
986992
w.filterManager.UnsubscribeFilter(id)
987993
}
988994

0 commit comments

Comments
 (0)