mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
gui/widget/listframe: don't let m_nCurrentLine become < 0
This commit is contained in:
@@ -327,6 +327,8 @@ void CListFrame::onNewLineArray(void)
|
|||||||
if(m_nCurrentLine >= m_nNrOfLines)
|
if(m_nCurrentLine >= m_nNrOfLines)
|
||||||
{
|
{
|
||||||
m_nCurrentPage = m_nNrOfPages - 1;
|
m_nCurrentPage = m_nNrOfPages - 1;
|
||||||
|
if (m_nCurrentPage < 0)
|
||||||
|
m_nCurrentPage = 0;
|
||||||
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
|
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
|
||||||
}
|
}
|
||||||
if(m_nSelectedLine >= m_nNrOfLines)
|
if(m_nSelectedLine >= m_nNrOfLines)
|
||||||
@@ -652,10 +654,10 @@ bool CListFrame::setSelectedLine(int selection)
|
|||||||
{
|
{
|
||||||
//TRACE("[CListFrame]->setSelectedLine %d \r\n",selection);
|
//TRACE("[CListFrame]->setSelectedLine %d \r\n",selection);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
if (selection >= m_nNrOfLines)
|
||||||
|
selection = m_nNrOfLines - 1;
|
||||||
if (selection < 0)
|
if (selection < 0)
|
||||||
selection = 0;
|
selection = 0;
|
||||||
else if (selection >= m_nNrOfLines)
|
|
||||||
selection = m_nNrOfLines - 1;
|
|
||||||
m_nSelectedLine = selection;
|
m_nSelectedLine = selection;
|
||||||
m_nCurrentPage = selection / m_nLinesPerPage;
|
m_nCurrentPage = selection / m_nLinesPerPage;
|
||||||
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
|
m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
|
||||||
|
Reference in New Issue
Block a user