Fix out-of-bounds access
This commit is contained in:
parent
eab338e380
commit
1c9fc51d01
@ -16,6 +16,8 @@ oled::~oled()
|
|||||||
|
|
||||||
pixel& oled::operator()(int x, int y)
|
pixel& oled::operator()(int x, int y)
|
||||||
{
|
{
|
||||||
|
static pixel dummy;
|
||||||
|
if (x < 0 || x >= width || y < 0 || y >= height) { return dummy; }
|
||||||
return pixels[x + y * width];
|
return pixels[x + y * width];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user