From 026ef954b815ee447472bd1adccf1b4ac3a87114 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Fri, 4 Oct 2024 15:23:22 +0300 Subject: [PATCH] [#1414] metabase: Check parameter for `CountAliveObjectsInBucket` Signed-off-by: Anton Nikiforov --- pkg/local_object_storage/metabase/list.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/metabase/list.go b/pkg/local_object_storage/metabase/list.go index 44f25246e..188667fec 100644 --- a/pkg/local_object_storage/metabase/list.go +++ b/pkg/local_object_storage/metabase/list.go @@ -452,10 +452,11 @@ func (db *DB) CountAliveObjectsInBucket(ctx context.Context, prm CountAliveObjec return 0, ErrDegradedMode } - cidRaw := prm.BucketName[1:bucketKeySize] - if cidRaw == nil { + if len(prm.BucketName) == 0 { return 0, nil } + + cidRaw := prm.BucketName[1:bucketKeySize] var count uint64 err := db.boltDB.View(func(tx *bbolt.Tx) error { bkt := tx.Bucket(prm.BucketName)