Skip to content

Commit 851346d

Browse files
committed
fix ub
1 parent acab867 commit 851346d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/chunk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Chunk {
2323
let voxel = shape.make_mut().as_voxels_mut().unwrap();
2424
let mut voxels = 0;
2525
unsafe {
26-
let ptr = cells.as_mut_ptr().as_mut().unwrap();
26+
let ptr = cells.as_mut_ptr().cast::<Cell>();
2727
for y in 0..CHUNK_MAP_HEIGHT {
2828
for x in 0..CHUNK_MAP_HEIGHT {
2929
let cell_index = MatrixIndex::new(x, y);
@@ -32,7 +32,7 @@ impl Chunk {
3232
voxels += 1;
3333
voxel.set_voxel(cell_index.into(), true);
3434
}
35-
*ptr.index_mut(cell_index) = cell;
35+
*ptr.add(cell_index.flatten().strict_cast()) = cell;
3636
}
3737
}
3838
(

0 commit comments

Comments
 (0)