From b79b13a4116c845e394a36c15859f1a7c8467095 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 6 Apr 2013 13:15:40 +0200 Subject: [PATCH] CChannelList: fix "prev bouquet" if empty bouquets are present also do proper wrap-around when selecting previous / next bouquet --- src/gui/channellist.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index fc643812f..abdb872a8 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -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;