Skip to content

Commit

Permalink
add guard (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlymatthew authored Jul 1, 2024
1 parent 64f1b73 commit 3865e79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/btree/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func (n *BTreeNode) Size() int64 {
size += encoding.SizeVarint(n)
}

if n.VectorDim == 0 {
panic("VectorDim cannot be zero")
}

size += encoding.SizeVarint(n.VectorDim)
size += len(n.Vectors) * (4 * int(n.VectorDim))

Expand Down

0 comments on commit 3865e79

Please sign in to comment.