Skip to content

Commit

Permalink
Merge pull request #120 from ksooo/fixes
Browse files Browse the repository at this point in the history
Fixed GetChannelGroupMembers off-by-one error
  • Loading branch information
ksooo authored Jan 3, 2022
2 parents e9e0989 + 4e33573 commit ab2c044
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pvr.demo/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.demo"
version="20.4.1"
version="20.4.2"
name="Demo PVR Client"
provider-name="Pulse-Eight Ltd., Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.demo/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v20.4.2
- Fixed GetChannelGroupMembers

v20.4.1
- Change name to make add-on easier to find in UI

Expand Down
9 changes: 6 additions & 3 deletions src/PVRDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,15 @@ PVR_ERROR CPVRDemo::GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& g
{
if (myGroup.strGroupName == group.GetGroupName())
{
for (const auto& iId : myGroup.members)
for (int iId : myGroup.members)
{
if (iId < 0 || iId > (int)m_channels.size() - 1)
if (iId < 1 || iId > static_cast<int>(m_channels.size()))
{
kodi::Log(ADDON_LOG_ERROR, "ignoring invalid channel id '%d')", iId);
continue;
}

PVRDemoChannel& channel = m_channels.at(iId);
PVRDemoChannel& channel = m_channels.at(iId - 1);
kodi::addon::PVRChannelGroupMember kodiGroupMember;
kodiGroupMember.SetGroupName(group.GetGroupName());
kodiGroupMember.SetChannelUniqueId(channel.iUniqueId);
Expand Down

0 comments on commit ab2c044

Please sign in to comment.