aboutsummaryrefslogtreecommitdiff
path: root/node.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2016-08-18 11:01:52 -0600
committerGitHub <noreply@github.com>2016-08-18 11:01:52 -0600
commit583e8937c61f1af6513608ccc75c97b6abdf4ff9 (patch)
tree3f90eabcfd6a26c8bbc021665ab996ed4325c492 /node.go
parentMerge pull request #579 from asdine/master (diff)
parentfix Go 1.7 pointer reference bug (diff)
downloaddedo-583e8937c61f1af6513608ccc75c97b6abdf4ff9.tar.gz
dedo-583e8937c61f1af6513608ccc75c97b6abdf4ff9.tar.xz
Merge pull request #584 from benbjohnson/go17
Fix Go 1.7 pointer reference bug
Diffstat (limited to 'node.go')
-rw-r--r--node.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/node.go b/node.go
index e9d64af..159318b 100644
--- a/node.go
+++ b/node.go
@@ -201,6 +201,11 @@ func (n *node) write(p *page) {
}
p.count = uint16(len(n.inodes))
+ // Stop here if there are no items to write.
+ if p.count == 0 {
+ return
+ }
+
// Loop over each item and write it to the page.
b := (*[maxAllocSize]byte)(unsafe.Pointer(&p.ptr))[n.pageElementSize()*len(n.inodes):]
for i, item := range n.inodes {