Improve safety in image updating

This commit is contained in:
Jarrod Doyle 2024-01-27 15:29:52 +00:00
parent 19671b8f28
commit ce4e13005f
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 10 additions and 9 deletions

View File

@ -65,7 +65,7 @@ pub fn update_chunk_texture_system(
} }
let (chunk, image_handle) = chunk.unwrap(); let (chunk, image_handle) = chunk.unwrap();
let image = images.get_mut(image_handle).unwrap(); if let Some(image) = images.get_mut(image_handle) {
for y in 0..chunk.height { for y in 0..chunk.height {
for x in 0..chunk.width { for x in 0..chunk.width {
// Just set each pixel to random colours for now // Just set each pixel to random colours for now
@ -77,3 +77,4 @@ pub fn update_chunk_texture_system(
} }
} }
} }
}