gui/channellist.cpp: safe-check in setSelected(), to prevent crash if incorrect selected set

Origin commit data
------------------
Branch: ni/coolstream
Commit: a3621a73ca
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-20 (Fri, 20 Apr 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-04-20 20:09:25 +04:00
parent debb97cdfc
commit ee2f5d5d3c

View File

@@ -105,7 +105,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl
selected_chid = 0; selected_chid = 0;
this->new_mode_active = false; this->new_mode_active = false;
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar
//printf("************ NEW LIST %s : %x\n", name.c_str(), this);fflush(stdout); //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout);
} }
CChannelList::~CChannelList() CChannelList::~CChannelList()
@@ -1026,13 +1026,13 @@ int CChannelList::hasChannelID(t_channel_id channel_id)
void CChannelList::setSelected( int nChannelNr) void CChannelList::setSelected( int nChannelNr)
{ {
//printf("CChannelList::setSelected me %s %d -> %s\n", name.c_str(), nChannelNr, (nChannelNr < chanlist.size() && chanlist[nChannelNr] != NULL) ? chanlist[nChannelNr]->getName().c_str() : "********* NONE *********"); //printf("CChannelList::setSelected me %s %d -> %s\n", name.c_str(), nChannelNr, (nChannelNr < chanlist.size() && chanlist[nChannelNr] != NULL) ? chanlist[nChannelNr]->getName().c_str() : "********* NONE *********");
selected = nChannelNr;
//FIXME real difference between tuned and selected ?! //FIXME real difference between tuned and selected ?!
tuned = nChannelNr; selected_chid = 0;
if(tuned < chanlist.size()) if (nChannelNr < (int) chanlist.size()) {
selected = nChannelNr;
tuned = nChannelNr;
selected_chid = chanlist[tuned]->getChannelID(); selected_chid = chanlist[tuned]->getChannelID();
else }
selected_chid = 0;
} }
// -- Zap to channel with channel_id // -- Zap to channel with channel_id