handle insertions correctly

The "Update" case for Slice containers is broken, and can
insert a container without inserting a key. Fix this by using
the existing insert/add logic.
This commit is contained in:
Seebs 2019-06-10 15:21:44 -05:00
parent bbb5766bc0
commit 089e7e127e

View file

@ -196,9 +196,7 @@ func (sc *sliceContainers) Update(key uint64, fn func(*Container, bool) (*Contai
// don't expand the slice just to add a nil container, we
// could return that anyway
if write && nc != nil {
sc.containers = append(sc.containers, nil)
copy(sc.containers[i+1:], sc.containers[i:])
sc.containers[i] = nc
sc.insertAt(key, nc, -i-1)
}
}
}