Skip to content

Commit

Permalink
fix: panic during removePubSubTopic (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem authored Sep 22, 2023
1 parent a84701a commit 9f4754d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion waku/v2/peerstore/waku_peer_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,12 @@ func (ps *WakuPeerstoreImpl) RemovePubSubTopic(p peer.ID, topic string) error {
}

for i := range existingTopics {
existingTopics = append(existingTopics[:i], existingTopics[i+1:]...)
if existingTopics[i] == topic {
existingTopics = append(existingTopics[:i], existingTopics[i+1:]...)
break
}
}

err = ps.SetPubSubTopics(p, existingTopics)
if err != nil {
return err
Expand Down

0 comments on commit 9f4754d

Please sign in to comment.