CTextBox: catching error if position has signed values

Wrong position assignments can trigger crash. Prevent segfaults.
Error log should indicate this.
This commit is contained in:
2015-03-19 08:00:25 +01:00
parent b9e04a4999
commit 459c120060

View File

@@ -56,7 +56,7 @@
#endif
#include <global.h>
#include <system/debug.h>
#include "textbox.h"
#include <gui/widget/icons.h>
@@ -553,7 +553,7 @@ void CTextBox::refreshText(void)
//bg variables
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY;
int ay = m_cFrameTextRel.iY+m_cFrame.iY;
int dx = m_cFrameTextRel.iWidth;
int dy = m_cFrameTextRel.iHeight;
@@ -569,6 +569,12 @@ void CTextBox::refreshText(void)
}
}
//detect corrupt position values
if ((ax<=0) || (ay<=0)){
dprintf(DEBUG_NORMAL, "\033[33m[CTextBox] [%s - %d] ERROR! position out of range: ax = %d, ay = %d, dx = %d, dy = %d\033[0m\n", __func__, __LINE__, ax, ay, dx, dy);
return;
}
//save screen only if no paint of background required
if (!m_nPaintBackground && m_SaveScreen) {
if (m_bgpixbuf == NULL){