mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 17:10:17 +00:00
fix(framebuffer): check width, height and implement proper checking when accessing pixels
This commit is contained in:
@@ -120,7 +120,8 @@ fn draw(image: DynamicImage) -> Result<()> {
|
||||
let image = resize_to_fit(&image, fit);
|
||||
|
||||
// Create a framebuffer to draw the image on.
|
||||
let mut framebuffer = Framebuffer::new(width, height);
|
||||
let mut framebuffer =
|
||||
Framebuffer::new(width, height).context("unable to create framebuffer")?;
|
||||
|
||||
// Iterate over the pixels in the image and put them on the framebuffer.
|
||||
for (x, y, pixel) in image.enumerate_pixels() {
|
||||
|
||||
Reference in New Issue
Block a user