src/neutrino.cpp fix possible segfault if g_bouquetManager is NULL

Origin commit data
------------------
Commit: c923944636
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-01-14 (Thu, 14 Jan 2016)
This commit is contained in:
Jacek Jendrzej
2016-01-14 19:09:06 +01:00
parent 73dc76ef70
commit 7eda013821

View File

@@ -1357,7 +1357,7 @@ void CNeutrinoApp::channelsInit(bool bOnly)
memset(radiosort, -1, sizeof(tvsort)); memset(radiosort, -1, sizeof(tvsort));
const char * fav_bouquetname = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); 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); g_bouquetManager->addBouquet(fav_bouquetname, true, true);
if(TVbouquetList) delete TVbouquetList; if(TVbouquetList) delete TVbouquetList;
@@ -1507,29 +1507,31 @@ void CNeutrinoApp::channelsInit(bool bOnly)
AllFavBouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS)); AllFavBouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS));
/* Favorites and providers bouquets */ /* Favorites and providers bouquets */
tvi = ri = 0; tvi = ri = 0;
for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) { if(g_bouquetManager){
CZapitBouquet *b = g_bouquetManager->Bouquets[i]; for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) {
if (!b->bHidden) { CZapitBouquet *b = g_bouquetManager->Bouquets[i];
if (b->getTvChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { if (!b->bHidden) {
if(b->bUser) if (b->getTvChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) {
tmp = TVfavList->addBouquet(b); if(b->bUser)
else tmp = TVfavList->addBouquet(b);
tmp = TVbouquetList->addBouquet(b); else
tmp = TVbouquetList->addBouquet(b);
tmp->channelList->SetChannelList(&zapitList); tmp->channelList->SetChannelList(&zapitList);
tvi++; tvi++;
} }
if (b->getRadioChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { if (b->getRadioChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) {
if(b->bUser) if(b->bUser)
tmp = RADIOfavList->addBouquet(b); tmp = RADIOfavList->addBouquet(b);
else else
tmp = RADIObouquetList->addBouquet(b); tmp = RADIObouquetList->addBouquet(b);
tmp->channelList->SetChannelList(&zapitList); tmp->channelList->SetChannelList(&zapitList);
ri++; ri++;
}
if(b->bUser)
AllFavBouquetList->addBouquet(b);
} }
if(b->bUser)
AllFavBouquetList->addBouquet(b);
} }
} }
#if 0 #if 0