diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2015-02-02 07:49:02 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2015-02-02 07:49:02 -0700 |
commit | b124606822b34eded372c7ebd15e8ff12fa4a40f (patch) | |
tree | 808df0d71e9c94045d2e8b30be7b1d5256a34c3f /cursor.go | |
parent | Merge pull request #292 from benbjohnson/fix-size (diff) | |
parent | Expand assertion statements. (diff) | |
download | dedo-b124606822b34eded372c7ebd15e8ff12fa4a40f.tar.gz dedo-b124606822b34eded372c7ebd15e8ff12fa4a40f.tar.xz |
Merge pull request #294 from benbjohnson/assert
Expand assertion statements
Diffstat (limited to 'cursor.go')
-rw-r--r-- | cursor.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2,6 +2,7 @@ package bolt import ( "bytes" + "fmt" "sort" ) @@ -228,8 +229,8 @@ func (c *Cursor) next() (key []byte, value []byte, flags uint32) { // search recursively performs a binary search against a given page/node until it finds a given key. func (c *Cursor) search(key []byte, pgid pgid) { p, n := c.bucket.pageNode(pgid) - if p != nil { - _assert((p.flags&(branchPageFlag|leafPageFlag)) != 0, "invalid page type: %d: %x", p.id, p.flags) + if p != nil && (p.flags&(branchPageFlag|leafPageFlag)) == 0 { + panic(fmt.Sprintf("invalid page type: %d: %x", p.id, p.flags)) } e := elemRef{page: p, node: n} c.stack = append(c.stack, e) |