[#1414] metabase: Check parameter for CountAliveObjectsInBucket
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 2m59s
DCO action / DCO (pull_request) Successful in 3m11s
Vulncheck / Vulncheck (pull_request) Successful in 3m56s
Build / Build Components (pull_request) Successful in 4m6s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m6s
Tests and linters / Staticcheck (pull_request) Successful in 4m2s
Tests and linters / gopls check (pull_request) Successful in 4m28s
Tests and linters / Tests with -race (pull_request) Successful in 5m34s
Tests and linters / Lint (pull_request) Successful in 5m49s
Tests and linters / Tests (pull_request) Successful in 6m8s

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-10-04 15:23:22 +03:00
parent 9a87acb87a
commit b96d5c9b02

View file

@ -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 prm.BucketName == nil {
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)