policer: Fix svacer warning #1254

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:fix/validate_nodes_len into master 2024-07-18 11:30:54 +00:00

View file

@ -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
}