mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 11:47:30 +01:00
Add bounds check for X (#1371)
Avoid crash if a draw goes to a negative X position.
This commit is contained in:
parent
c9055f2aef
commit
b493d5bba5
@ -132,7 +132,7 @@ void HOT MAX7219Component::draw_absolute_pixel_internal(int x, int y, Color colo
|
||||
this->max_displaybuffer_.resize(x + 1, this->bckgrnd_);
|
||||
}
|
||||
|
||||
if (y >= this->get_height_internal() || y < 0) // If pixel is outside display then dont draw
|
||||
if ((y >= this->get_height_internal()) || (y < 0) || (x < 0)) // If pixel is outside display then dont draw
|
||||
return;
|
||||
|
||||
uint16_t pos = x; // X is starting at 0 top left
|
||||
|
Loading…
Reference in New Issue
Block a user