Prevents division by zero.

- In particular text box dimensions was a division by zero.


git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1831 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
micha-bbg
2011-11-05 23:32:53 +00:00
parent 1bb7728e6d
commit b4186edcb8

View File

@@ -233,7 +233,7 @@ void CTextBox::initFramesRel(void)
m_cFrameTextRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth; m_cFrameTextRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth;
m_nLinesPerPage = (m_cFrameTextRel.iHeight - (2*TEXT_BORDER_WIDTH)) / m_nFontTextHeight; m_nLinesPerPage = std::max(1, (m_cFrameTextRel.iHeight - (2*TEXT_BORDER_WIDTH)) / m_nFontTextHeight);
#if 0 #if 0
TRACE_1("Frames\r\n\tScren:\t%3d,%3d,%3d,%3d\r\n\tMain:\t%3d,%3d,%3d,%3d\r\n\tText:\t%3d,%3d,%3d,%3d \r\n\tScroll:\t%3d,%3d,%3d,%3d \r\n", TRACE_1("Frames\r\n\tScren:\t%3d,%3d,%3d,%3d\r\n\tMain:\t%3d,%3d,%3d,%3d\r\n\tText:\t%3d,%3d,%3d,%3d \r\n\tScroll:\t%3d,%3d,%3d,%3d \r\n",
@@ -369,7 +369,7 @@ void CTextBox::refreshTextLineArray(void)
reSizeMainFrameHeight(m_nNrOfLines * m_nFontTextHeight); reSizeMainFrameHeight(m_nNrOfLines * m_nFontTextHeight);
} }
m_nLinesPerPage = (m_cFrameTextRel.iHeight - (2*TEXT_BORDER_WIDTH)) / m_nFontTextHeight; m_nLinesPerPage = std::max(1, (m_cFrameTextRel.iHeight - (2*TEXT_BORDER_WIDTH)) / m_nFontTextHeight);
m_nNrOfPages = ((m_nNrOfLines-1) / m_nLinesPerPage) + 1; m_nNrOfPages = ((m_nNrOfLines-1) / m_nLinesPerPage) + 1;
if(m_nCurrentPage >= m_nNrOfPages) if(m_nCurrentPage >= m_nNrOfPages)