Commit 496c710a authored by nikandfor's avatar nikandfor

Fix slice out of bounds crash

There was crash when we try insert element to full data struct at position i=0
when left neighbour data struct was not full
parent b96e30f1
......@@ -451,12 +451,17 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{
l, r := p.siblings(pi)
if l != nil && l.c < 2*kd {
if i > 0 {
l.mvL(q, 1)
t.insert(q, i-1, k, v)
p.x[pi-1].k = q.d[0].k
return
}
t.insert(l, l.c, k, v)
return
}
if r != nil && r.c < 2*kd {
if i < 2*kd {
q.mvR(r, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment