screen: fix off by one error in readCell bounds checks

This commit is contained in:
CJ van den Berg 2024-05-20 00:07:39 +02:00 committed by Tim Culverhouse
parent 0333e178bd
commit 9906a67ef6

View file

@ -66,11 +66,11 @@ pub fn writeCell(self: *Screen, col: usize, row: usize, cell: Cell) void {
}
pub fn readCell(self: *Screen, col: usize, row: usize) ?Cell {
if (self.width < col) {
if (self.width <= col) {
// column out of bounds
return null;
}
if (self.height < row) {
if (self.height <= row) {
// height out of bounds
return null;
}