[#356] netmap: Fix post-loop handling of zero subnet in IterateSubnets

Return any error other than `ErrRemoveSubnet` from `IterateSubnets`
during post-loop processing of zero subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/master
Leonard Lyubich 2021-11-23 17:11:15 +03:00 committed by LeL
parent 5ce4b22e40
commit d93828f465
1 changed files with 5 additions and 1 deletions

View File

@ -202,7 +202,11 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error {
refs.MakeZeroSubnet(&id)
err = f(id)
if errors.Is(err, ErrRemoveSubnet) {
if err != nil {
if !errors.Is(err, ErrRemoveSubnet) {
return err
}
// zero subnet should be clearly removed with False value
var attr Attribute