Merge pull request #17 from heyitsanthony/fix543

Fix issue #543 'bolt bench crashes'
pull/20/head
Anthony Romano 2017-08-11 10:43:53 -07:00 committed by GitHub
commit 533739c662
1 changed files with 7 additions and 5 deletions

View File

@ -1169,12 +1169,14 @@ func (cmd *BenchCommand) runReadsSequentialNested(db *bolt.DB, options *BenchOpt
var count int
var top = tx.Bucket(benchBucketName)
if err := top.ForEach(func(name, _ []byte) error {
c := top.Bucket(name).Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
if v == nil {
return ErrInvalidValue
if b := top.Bucket(name); b != nil {
c := b.Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
if v == nil {
return ErrInvalidValue
}
count++
}
count++
}
return nil
}); err != nil {