screen: fix off by one error in writeCell bounds checks

This commit is contained in:
CJ van den Berg 2024-05-17 21:55:44 +02:00 committed by Tim Culverhouse
parent 329ba0e43b
commit 0333e178bd

View file

@ -52,11 +52,11 @@ pub fn deinit(self: *Screen, alloc: std.mem.Allocator) void {
/// writes a cell to a location. 0 indexed /// writes a cell to a location. 0 indexed
pub fn writeCell(self: *Screen, col: usize, row: usize, cell: Cell) void { pub fn writeCell(self: *Screen, col: usize, row: usize, cell: Cell) void {
if (self.width < col) { if (self.width <= col) {
// column out of bounds // column out of bounds
return; return;
} }
if (self.height < row) { if (self.height <= row) {
// height out of bounds // height out of bounds
return; return;
} }