CTextBox: ensure restore of background, if pixbuf exists

This may prevent undefined behavior or even possible segfaults
This commit is contained in:
2013-10-20 02:54:46 +02:00
parent 8e246f16a8
commit 302649eca4

View File

@@ -525,13 +525,16 @@ void CTextBox::refreshText(void)
//Paint Text Background //Paint Text Background
if (m_nPaintBackground){ if (m_nPaintBackground){
if (m_bgpixbuf) if (m_bgpixbuf){
delete[] m_bgpixbuf; delete[] m_bgpixbuf;
m_bgpixbuf = NULL; m_bgpixbuf = NULL;
}
frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType); frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
} }
else else{
frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf); if (m_bgpixbuf)
frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf);
}
if( m_nNrOfLines <= 0) if( m_nNrOfLines <= 0)
return; return;