Improve safety in image updating
This commit is contained in:
parent
19671b8f28
commit
ce4e13005f
|
@ -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
|
||||||
|
@ -76,4 +76,5 @@ pub fn update_chunk_texture_system(
|
||||||
image.data[index + 3] = 255;
|
image.data[index + 3] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue