From 87cbb564a3ac59f5e9e94d0c59481ed70628c8e7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 13 Apr 2015 10:37:45 +0200 Subject: [PATCH] CTextBox: ensure save screen only if dimensions are valid 0 values are critical --- src/gui/widget/textbox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index bbe28d4a3..315f94482 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -579,8 +579,10 @@ void CTextBox::refreshText(void) if (!m_nPaintBackground && m_SaveScreen) { if (m_bgpixbuf == NULL){ //TRACE("[CTextBox] %s save bg %d\r\n", __FUNCTION__, __LINE__); - m_bgpixbuf= new fb_pixel_t[dx * dy]; - frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf); + if ((dx * dy) >0){ + m_bgpixbuf= new fb_pixel_t[dx * dy]; + frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf); + } } }