CChannelList: fix "prev bouquet" if empty bouquets are present

also do proper wrap-around when selecting previous / next bouquet


Origin commit data
------------------
Branch: ni/coolstream
Commit: b79b13a411
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-04-06 (Sat, 06 Apr 2013)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2013-04-06 13:15:40 +02:00
committed by [CST] Focus
parent 6f534c2fd6
commit f2f486606b

View File

@@ -749,12 +749,13 @@ int CChannelList::show()
if (!bouquetList->Bouquets.empty()) {
bool found = true;
int dir = msg == (neutrino_msg_t)g_settings.key_bouquet_up ? 1 : -1;
int b_size = bouquetList->Bouquets.size();
int b_size = bouquetList->Bouquets.size(); /* bigger than 0 */
int nNext = (bouquetList->getActiveBouquetNumber() + b_size + dir) % b_size;
if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) {
found = false;
int n_old = nNext;
nNext = (nNext + b_size + dir) % b_size;
for (int i = nNext; i < b_size; i++) {
for (int i = nNext; i != n_old; i = (i + b_size + dir) % b_size) {
if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) {
found = true;
nNext = i;