From c41b6f7c53f7f9737a9ef7edc730c72ae98f9203 Mon Sep 17 00:00:00 2001 From: Denis Dyakov Date: Fri, 13 Mar 2020 23:40:49 +0600 Subject: [PATCH] Fix unexpected delete bucket error --- bucket.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bucket.go b/bucket.go index f889684..e3e7fbc 100644 --- a/bucket.go +++ b/bucket.go @@ -228,7 +228,7 @@ func (b *Bucket) DeleteBucket(key []byte) error { // Recursively delete all child buckets. child := b.Bucket(key) err := child.ForEach(func(k, v []byte) error { - if v == nil { + if _, _, childFlags := child.Cursor().seek(k); (childFlags & bucketLeafFlag) != 0 { if err := child.DeleteBucket(k); err != nil { return fmt.Errorf("delete bucket: %s", err) }