mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +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
1 changed files with 1 additions and 1 deletions
|
@ -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 a new issue