Commit 311e0d84 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent edd535de
......@@ -204,14 +204,21 @@ loop:
case *d:
switch {
case op == opSet && !ok:
bad("key %v not found after set", k)
switch op {
case opSet:
if !ok {
bad("key %v not found after set", k)
}
case op == opDel && ok:
bad("key %v found after delete", k)
case opDel:
if ok {
bad("key %v found after delete", k)
}
// XXX adjust i to be in range for opDel
// delted last element or tried to delete element past max k in x
if i >= x.c {
i = x.c - 1
}
}
dd = x
......
......@@ -323,7 +323,11 @@ func (t *Tree) Delete(k interface{} /*K*/) (ok bool) {
switch {
case !ok:
dbg("ok'")
t.hitDi = i // XXX ok ? (i > h)
if i >= dd.c {
// tried to delete element past max k in hitD
i = dd.c - 1
}
t.hitDi = i
return false
case dd.c > kd:
......
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