From 5e5ee545b6c0f42c08c492fa325e0d43de0e93c2 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 17 Jul 2024 14:30:51 +0300 Subject: [PATCH] [#1254] policer: Fix svacer warning Signed-off-by: Dmitrii Stepanov --- pkg/services/policer/ec.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/services/policer/ec.go b/pkg/services/policer/ec.go index 5b3793f7b..0a118797d 100644 --- a/pkg/services/policer/ec.go +++ b/pkg/services/policer/ec.go @@ -25,7 +25,7 @@ type ecChunkProcessResult struct { removeLocal bool } -var errInvalidECPlacement = errors.New("invalid EC placement: EC placement must have one placement vector") +var errInvalidECPlacement = errors.New("invalid EC placement: EC placement must have one placement vector with at least one node") func (p *Policer) processECContainerObject(ctx context.Context, objInfo objectcore.Info, policy netmap.PlacementPolicy) error { if objInfo.ECInfo == nil { @@ -42,7 +42,7 @@ func (p *Policer) processECContainerRepObject(ctx context.Context, objInfo objec if err != nil { return fmt.Errorf("%s: %w", logs.PolicerCouldNotBuildPlacementVectorForObject, err) } - if len(nn) != 1 { + if len(nn) != 1 || len(nn[0]) == 0 { return errInvalidECPlacement } @@ -72,7 +72,7 @@ func (p *Policer) processECContainerECObject(ctx context.Context, objInfo object if err != nil { return fmt.Errorf("%s: %w", logs.PolicerCouldNotBuildPlacementVectorForObject, err) } - if len(nn) != 1 { + if len(nn) != 1 || len(nn[0]) == 0 { return errInvalidECPlacement }