Skip to content

Commit

Permalink
Merge pull request #484 from arthur-liberman/Leia
Browse files Browse the repository at this point in the history
Fix crash after restarting the addon
  • Loading branch information
phunkyfish authored Feb 22, 2021
2 parents eafb18c + a692043 commit bf62c49
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="3.10.0"
version="3.10.1"
name="PVR IPTV Simple Client"
provider-name="nightik">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.10.1
- Fixed: Addon crashes when it is restarted

v3.10.0
- Added: Support for EXTGRP markers for channel groups

Expand Down
13 changes: 6 additions & 7 deletions src/PVRIptvData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ bool PVRIptvData::LoadPlayList(void)
bool bFirst = true;
bool bIsRealTime = true;
int iChannelIndex = 0;
int iUniqueGroupId = 0;
int iChannelNum = g_iStartNumber;
int iEPGTimeShift = 0;
bool bRadio = false;
Expand Down Expand Up @@ -728,14 +729,14 @@ bool PVRIptvData::LoadPlayList(void)
}

iChannelGroupName = strGroupName;
ProcessGroupLine(strGroupName, bRadio, iCurrentGroupId);
ProcessGroupLine(strGroupName, bRadio, iUniqueGroupId, iCurrentGroupId);
}
}
else if (iChannelGroupName.empty() && StringUtils::Left(strLine, strlen(M3U_GROUP_MARKER)) == M3U_GROUP_MARKER)
{
iChannelGroupName = StringUtils::Right(strLine, static_cast<int>(strLine.size()) - strlen(M3U_GROUP_MARKER));
iChannelGroupName = StringUtils::Trim(iChannelGroupName);
ProcessGroupLine(iChannelGroupName, bRadio, iCurrentGroupId);
ProcessGroupLine(iChannelGroupName, bRadio, iUniqueGroupId, iCurrentGroupId);
}
else if (StringUtils::Left(strLine, strlen(KODIPROP_MARKER)) == KODIPROP_MARKER)
{
Expand Down Expand Up @@ -846,10 +847,8 @@ bool PVRIptvData::LoadPlayList(void)
return true;
}

void PVRIptvData::ProcessGroupLine(std::string groupsLine, bool bRadio, std::vector<int>& iCurrentGroupId)
void PVRIptvData::ProcessGroupLine(std::string groupsLine, bool bRadio, int &uniqueGroupId, std::vector<int>& iCurrentGroupId)
{
static int iUniqueGroupId = 0;

if (!groupsLine.empty())
{
std::stringstream streamGroups(groupsLine);
Expand All @@ -863,11 +862,11 @@ void PVRIptvData::ProcessGroupLine(std::string groupsLine, bool bRadio, std::vec
{
PVRIptvChannelGroup group;
group.strGroupName = groupsLine;
group.iGroupId = ++iUniqueGroupId;
group.iGroupId = ++uniqueGroupId;
group.bRadio = bRadio;

m_groups.push_back(group);
iCurrentGroupId.push_back(iUniqueGroupId);
iCurrentGroupId.push_back(uniqueGroupId);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/PVRIptvData.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class PVRIptvData : public P8PLATFORM::CThread
static bool ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumberString, PVRIptvEpgEntry& entry);
static bool ParseOnScreenEpisodeNumberInfo(const std::string& episodeNumberString, PVRIptvEpgEntry& entry);

virtual void ProcessGroupLine(std::string groupsLine, bool bRadio, std::vector<int>& iCurrentGroupId);
virtual void ProcessGroupLine(std::string groupsLine, bool bRadio, int &uniqueGroupId, std::vector<int>& iCurrentGroupId);

bool m_bTSOverride;
int m_iEPGTimeShift;
Expand Down

0 comments on commit bf62c49

Please sign in to comment.