diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2016-08-18 11:01:52 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-18 11:01:52 -0600 |
commit | 583e8937c61f1af6513608ccc75c97b6abdf4ff9 (patch) | |
tree | 3f90eabcfd6a26c8bbc021665ab996ed4325c492 /page.go | |
parent | Merge pull request #579 from asdine/master (diff) | |
parent | fix Go 1.7 pointer reference bug (diff) | |
download | dedo-583e8937c61f1af6513608ccc75c97b6abdf4ff9.tar.gz dedo-583e8937c61f1af6513608ccc75c97b6abdf4ff9.tar.xz |
Merge pull request #584 from benbjohnson/go17
Fix Go 1.7 pointer reference bug
Diffstat (limited to 'page.go')
-rw-r--r-- | page.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -62,6 +62,9 @@ func (p *page) leafPageElement(index uint16) *leafPageElement { // leafPageElements retrieves a list of leaf nodes. func (p *page) leafPageElements() []leafPageElement { + if p.count == 0 { + return nil + } return ((*[0x7FFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[:] } @@ -72,6 +75,9 @@ func (p *page) branchPageElement(index uint16) *branchPageElement { // branchPageElements retrieves a list of branch nodes. func (p *page) branchPageElements() []branchPageElement { + if p.count == 0 { + return nil + } return ((*[0x7FFFFFF]branchPageElement)(unsafe.Pointer(&p.ptr)))[:] } |