Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ impl DrawTarget for Buffer {
// Check if the pixel coordinates are out of bounds (negative or greater than
// (63,63)). `DrawTarget` implementation are required to discard any out of bounds
// pixels without returning an error or causing a panic.
if coord.x < self.width as i32 && coord.y < self.height as i32 {
if coord.x >= 0
&& coord.y >= 0
&& coord.x < self.width as i32
&& coord.y < self.height as i32
{
// Calculate the index in the framebuffer.
let pixel = self.pixel(coord.x as usize, coord.y as usize).unwrap();
pixel.red = color.r();
Expand Down
Loading