From 7eda0138215cee98b71d2b9cd530bde83f4a0dd5 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 14 Jan 2016 19:09:06 +0100 Subject: [PATCH] src/neutrino.cpp fix possible segfault if g_bouquetManager is NULL Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c923944636bd2d943282481e083d99a0f8c6bc26 Author: Jacek Jendrzej Date: 2016-01-14 (Thu, 14 Jan 2016) --- src/neutrino.cpp | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 871f09e5d..9c5bd6fa8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1357,7 +1357,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) memset(radiosort, -1, sizeof(tvsort)); const char * fav_bouquetname = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); - if(g_bouquetManager->existsUBouquet(fav_bouquetname, true) == -1) + if(g_bouquetManager && g_bouquetManager->existsUBouquet(fav_bouquetname, true) == -1) g_bouquetManager->addBouquet(fav_bouquetname, true, true); if(TVbouquetList) delete TVbouquetList; @@ -1507,29 +1507,31 @@ void CNeutrinoApp::channelsInit(bool bOnly) AllFavBouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS)); /* Favorites and providers bouquets */ tvi = ri = 0; - for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) { - CZapitBouquet *b = g_bouquetManager->Bouquets[i]; - if (!b->bHidden) { - if (b->getTvChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { - if(b->bUser) - tmp = TVfavList->addBouquet(b); - else - tmp = TVbouquetList->addBouquet(b); + if(g_bouquetManager){ + for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) { + CZapitBouquet *b = g_bouquetManager->Bouquets[i]; + if (!b->bHidden) { + if (b->getTvChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { + if(b->bUser) + tmp = TVfavList->addBouquet(b); + else + tmp = TVbouquetList->addBouquet(b); - tmp->channelList->SetChannelList(&zapitList); - tvi++; - } - if (b->getRadioChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { - if(b->bUser) - tmp = RADIOfavList->addBouquet(b); - else - tmp = RADIObouquetList->addBouquet(b); + tmp->channelList->SetChannelList(&zapitList); + tvi++; + } + if (b->getRadioChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { + if(b->bUser) + tmp = RADIOfavList->addBouquet(b); + else + tmp = RADIObouquetList->addBouquet(b); - tmp->channelList->SetChannelList(&zapitList); - ri++; + tmp->channelList->SetChannelList(&zapitList); + ri++; + } + if(b->bUser) + AllFavBouquetList->addBouquet(b); } - if(b->bUser) - AllFavBouquetList->addBouquet(b); } } #if 0