Skip to content

Commit

Permalink
fix unwrap error on collision
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Apr 10, 2024
1 parent e898374 commit fb3546a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion azalea-physics/src/collision/world_collisions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> {
let mut block_collisions = Vec::new();

let initial_chunk_pos = ChunkPos::from(state.cursor.origin());
let initial_chunk = world.chunks.get(&initial_chunk_pos).unwrap();
let initial_chunk = match world.chunks.get(&initial_chunk_pos) {
Some(chunk) => chunk,
None => return block_collisions,
};
let initial_chunk = initial_chunk.read();

while let Some(item) = state.cursor.next() {
Expand Down

0 comments on commit fb3546a

Please sign in to comment.