Work around a block mapping bug
This commit is contained in:
parent
df37ec283d
commit
d719e117ad
|
@ -40,13 +40,16 @@ impl BlockStorage {
|
||||||
if old == b {
|
if old == b {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Clean up old block
|
// Clean up the old block
|
||||||
{
|
{
|
||||||
let idx = self.rev_block_map[&old];
|
// BUG: This lookup should never fail but sometimes will
|
||||||
let info = &mut self.block_map[idx];
|
// due to an issue with loading chunks from the server.
|
||||||
info.1 -= 1;
|
if let Some(idx) = self.rev_block_map.get(&old).cloned() {
|
||||||
if info.1 == 0 { // None left of this type
|
let info = &mut self.block_map[idx];
|
||||||
self.rev_block_map.remove(&old);
|
info.1 -= 1;
|
||||||
|
if info.1 == 0 { // None left of this type
|
||||||
|
self.rev_block_map.remove(&old);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue