fix: panic when removing pubsub topic (#759)

This commit is contained in:
richΛrd 2023-09-21 05:33:19 -04:00 committed by GitHub
parent c132ee4303
commit d317b294a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,6 +165,11 @@ func (ps *WakuPeerstoreImpl) RemovePubSubTopic(p peer.ID, topic string) error {
if err != nil {
return err
}
if len(existingTopics) == 0 {
return nil
}
for i := range existingTopics {
existingTopics = append(existingTopics[:i], existingTopics[i+1:]...)
}