mirror of https://github.com/status-im/go-waku.git
fix: panic during removePubSubTopic (#765)
This commit is contained in:
parent
a84701abaa
commit
9f4754dcae
|
@ -171,8 +171,12 @@ func (ps *WakuPeerstoreImpl) RemovePubSubTopic(p peer.ID, topic string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range existingTopics {
|
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)
|
err = ps.SetPubSubTopics(p, existingTopics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue