mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-17 18:33:41 +02:00
neutrinoyparser.cpp, tuxboxapi: avoid possible crashes without g_bouquetManager instance
This was observed without physical frontends and in certain circumstances while using the web interface, e.g. if users are using bouquet functionalities.
This commit is contained in:
@@ -1414,6 +1414,9 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
|
void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
|
||||||
{
|
{
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
TOutType outType = hh->outStart(true /*old mode*/);
|
TOutType outType = hh->outStart(true /*old mode*/);
|
||||||
|
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
@@ -2155,6 +2158,9 @@ void CControlAPI::ReloadNeutrinoSetupCGI(CyhookHandler *hh)
|
|||||||
|
|
||||||
void CControlAPI::ReloadPluginsCGI(CyhookHandler *hh)
|
void CControlAPI::ReloadPluginsCGI(CyhookHandler *hh)
|
||||||
{
|
{
|
||||||
|
if (g_Plugins == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
g_Plugins->loadPlugins();
|
g_Plugins->loadPlugins();
|
||||||
hh->SendOk();
|
hh->SendOk();
|
||||||
}
|
}
|
||||||
|
@@ -217,6 +217,9 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st
|
|||||||
std::string yresult, sel, nr_str, do_show_hidden;
|
std::string yresult, sel, nr_str, do_show_hidden;
|
||||||
int nr=1;
|
int nr=1;
|
||||||
|
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "0";
|
||||||
|
|
||||||
ySplitString(para," ",nr_str, do_show_hidden);
|
ySplitString(para," ",nr_str, do_show_hidden);
|
||||||
if(!nr_str.empty())
|
if(!nr_str.empty())
|
||||||
nr = atoi(nr_str.c_str());
|
nr = atoi(nr_str.c_str());
|
||||||
@@ -244,6 +247,9 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler *, std::string para)
|
std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler *, std::string para)
|
||||||
{
|
{
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "";
|
||||||
|
|
||||||
std::string yresult, ytemplate, do_show_hidden;
|
std::string yresult, ytemplate, do_show_hidden;
|
||||||
|
|
||||||
ySplitString(para,"~",ytemplate, do_show_hidden);
|
ySplitString(para,"~",ytemplate, do_show_hidden);
|
||||||
@@ -268,6 +274,9 @@ std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler *
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, std::string)
|
std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, std::string)
|
||||||
{
|
{
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "0";
|
||||||
|
|
||||||
int actual=0;
|
int actual=0;
|
||||||
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
||||||
if(g_bouquetManager->existsChannelInBouquet(i, CZapit::getInstance()->GetCurrentChannelID())) {
|
if(g_bouquetManager->existsChannelInBouquet(i, CZapit::getInstance()->GetCurrentChannelID())) {
|
||||||
@@ -320,6 +329,10 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, st
|
|||||||
std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std::string para)
|
std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std::string para)
|
||||||
{
|
{
|
||||||
int BouquetNr = 0;
|
int BouquetNr = 0;
|
||||||
|
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "0";
|
||||||
|
|
||||||
std::string abnumber, tmp,yresult;
|
std::string abnumber, tmp,yresult;
|
||||||
ZapitChannelList channels;
|
ZapitChannelList channels;
|
||||||
//int num;
|
//int num;
|
||||||
@@ -1125,6 +1138,9 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
|
|||||||
hh->ParamList["timer_repeatCount"] = itoa(timer.repeatCount);
|
hh->ParamList["timer_repeatCount"] = itoa(timer.repeatCount);
|
||||||
|
|
||||||
// program row
|
// program row
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "";
|
||||||
|
|
||||||
t_channel_id current_channel = (cmd == "new") ? CZapit::getInstance()->GetCurrentChannelID() : timer.channel_id;
|
t_channel_id current_channel = (cmd == "new") ? CZapit::getInstance()->GetCurrentChannelID() : timer.channel_id;
|
||||||
CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin();
|
CBouquetManager::ChannelIterator cit = g_bouquetManager->tvChannelsBegin();
|
||||||
for (; !(cit.EndOfChannels()); cit++) {
|
for (; !(cit.EndOfChannels()); cit++) {
|
||||||
@@ -1174,6 +1190,9 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std::string para)
|
std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std::string para)
|
||||||
{
|
{
|
||||||
|
if (g_bouquetManager == NULL)
|
||||||
|
return "0";
|
||||||
|
|
||||||
std::string yresult;
|
std::string yresult;
|
||||||
int selected = -1;
|
int selected = -1;
|
||||||
if (hh->ParamList["saved"] == "1")
|
if (hh->ParamList["saved"] == "1")
|
||||||
|
Reference in New Issue
Block a user