Skip to content

Commit

Permalink
src/gui/channellist.cpp: try to fix segfault on channels reload
Browse files Browse the repository at this point in the history
  • Loading branch information
satbaby committed Sep 14, 2020
1 parent 946a613 commit 9aa2a57
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gui/channellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,13 @@ CZapitChannel* CChannelList::getChannel(int number)

CZapitChannel* CChannelList::getChannel(t_channel_id channel_id)
{
for (uint32_t i=0; i< (*chanlist).size(); i++) {
if ((*chanlist)[i]->getChannelID() == channel_id)
return (*chanlist)[i];
if(channel_id != -1 && !(*chanlist).empty()){
for (uint32_t i=0; i< (*chanlist).size(); i++) {
if ((*chanlist)[i]->getChannelID() == channel_id)
return (*chanlist)[i];
}
}
return(NULL);
return NULL;
}

int CChannelList::getKey(int id)
Expand Down

0 comments on commit 9aa2a57

Please sign in to comment.