valgrinding

master
Mike 5 years ago
parent df926f965c
commit c61f6e998d

@ -59,8 +59,10 @@ pub fn SparseSet(comptime SparseT: type) type {
fn assure(self: *Self, pos: usize) []SparseT { fn assure(self: *Self, pos: usize) []SparseT {
if (pos >= self.sparse.items.len) { if (pos >= self.sparse.items.len) {
const start_pos = self.sparse.items.len;
self.sparse.resize(pos + 1) catch unreachable; self.sparse.resize(pos + 1) catch unreachable;
self.sparse.expandToCapacity(); self.sparse.expandToCapacity();
std.mem.set(?[]SparseT, self.sparse.items[start_pos..], null);
} }
if (self.sparse.items[pos]) |arr| { if (self.sparse.items[pos]) |arr| {

Loading…
Cancel
Save