epgplus: avoid segfaults

This commit is contained in:
Jacek Jendrzej
2019-12-30 00:09:08 +01:00
parent 4d5d2f47b9
commit 34fd452de4

View File

@@ -974,7 +974,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
refreshAll = true;
break;
}
else if (msg == CRCInput::RC_page_down)
else if (msg == CRCInput::RC_page_down && this->selectedChannelEntry != NULL)
{
int selected = this->selectedChannelEntry->index;
int prev_selected = selected;
@@ -995,7 +995,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
this->createChannelEntries(selected);
this->paint();
}
else if (msg == CRCInput::RC_page_up)
else if (msg == CRCInput::RC_page_up && this->selectedChannelEntry != NULL)
{
int selected = this->selectedChannelEntry->index;
int prev_selected = selected;
@@ -1085,7 +1085,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
}
current_bouquet = bouquetList->getActiveBouquetNumber();
}
else if (CRCInput::isNumeric(msg))
else if (CRCInput::isNumeric(msg) && !bouquetList->Bouquets.empty())
{
this->hide();
CNeutrinoApp::getInstance()->channelList->numericZap(msg);
@@ -1107,7 +1107,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
}
}
else if (msg == CRCInput::RC_up)
else if (msg == CRCInput::RC_up && this->selectedChannelEntry != NULL)
{
int selectedChannelEntryIndex = this->selectedChannelEntry->index;
int prevSelectedChannelEntryIndex = selectedChannelEntryIndex;
@@ -1135,7 +1135,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
this->paintChannelEntry(selectedChannelEntryIndex - this->channelListStartIndex);
}
}
else if (msg == CRCInput::RC_down)
else if (msg == CRCInput::RC_down && this->selectedChannelEntry != NULL)
{
int selectedChannelEntryIndex = this->selectedChannelEntry->index;
int prevSelectedChannelEntryIndex = this->selectedChannelEntry->index;
@@ -1207,6 +1207,9 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
}
case ViewMode_Scroll:
{
if(this->selectedChannelEntry == NULL)
break;
TCChannelEventEntries::const_iterator It = this->getSelectedEvent();
if ((It != this->selectedChannelEntry->channelEventEntries.begin())
@@ -1258,6 +1261,9 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
}
case ViewMode_Scroll:
{
if(this->selectedChannelEntry == NULL)
break;
TCChannelEventEntries::const_iterator It = this->getSelectedEvent();
if ((It != this->selectedChannelEntry->channelEventEntries.end() - 1)
@@ -1284,7 +1290,7 @@ int EpgPlus::exec(CChannelList * pchannelList, int selectedChannelIndex, CBouque
}
}
}
else if (msg == CRCInput::RC_info)
else if (msg == CRCInput::RC_info && this->selectedChannelEntry != NULL)
{
TCChannelEventEntries::const_iterator It = this->getSelectedEvent();
@@ -1402,7 +1408,7 @@ void EpgPlus::hide()
this->header->head = NULL;
}
if (this->selectedChannelEntry->detailsLine) {
if (this->selectedChannelEntry && this->selectedChannelEntry->detailsLine) {
this->selectedChannelEntry->detailsLine->kill();
delete this->selectedChannelEntry->detailsLine;
this->selectedChannelEntry->detailsLine = NULL;