fontrenderer.cpp: prevent possible crash when text parameter == NULL

Observed e.g. with undefined behavior within threads

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
NadjaW
2019-04-28 11:22:15 +02:00
committed by Thilo Graf
parent f1e582e109
commit d1699ac2b4

View File

@@ -469,6 +469,11 @@ void Font::paintFontPixel(fb_pixel_t *td, uint8_t src)
void Font::RenderString(int x, int y, const int width, const char *text, const fb_pixel_t color, const int boxheight, const unsigned int flags, fb_pixel_t *buffer, int _stride)
{
if (!text){
dprintf(DEBUG_DEBUG,"\033[33m[Font] [%s - %d] ERROR! parameter text = [%p]\033[0m\n", __func__, __LINE__, text);
return;
}
bool render_to_fb = (buffer == NULL);
if (render_to_fb && !frameBuffer->getActive())
return;