Add safeguards for drawText() & drawSizedText()
This commit is contained in:
@@ -908,6 +908,7 @@ uint8_t BitmapBuffer::drawChar(coord_t x, coord_t y, const uint8_t * font, const
|
|||||||
|
|
||||||
coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags)
|
coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags)
|
||||||
{
|
{
|
||||||
|
if (!s) return (flags & VERTICAL) ? y : x;
|
||||||
MOVE_OFFSET();
|
MOVE_OFFSET();
|
||||||
|
|
||||||
int height = getFontHeight(flags);
|
int height = getFontHeight(flags);
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
|
|||||||
|
|
||||||
coord_t drawText(coord_t x, coord_t y, const char * s, LcdFlags flags = 0)
|
coord_t drawText(coord_t x, coord_t y, const char * s, LcdFlags flags = 0)
|
||||||
{
|
{
|
||||||
|
if (!s) return (flags & VERTICAL) ? y : x;
|
||||||
return drawSizedText(x, y, s, 255, flags);
|
return drawSizedText(x, y, s, 255, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user