Skip to content

Commit

Permalink
Merge pull request #121 from ksooo/fixes-matrix
Browse files Browse the repository at this point in the history
Matrix: Fixed GetChannelGroupMembers off-by-one error
  • Loading branch information
ksooo authored Jan 3, 2022
2 parents 2d316ee + 02550ce commit d957853
Show file tree
Hide file tree
Showing 3 changed files with 13 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="19.0.1"
version="19.0.2"
name="PVR Demo Client"
provider-name="Pulse-Eight Ltd., Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
6 changes: 6 additions & 0 deletions pvr.demo/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v19.0.2
- Fixed GetChannelGroupMembers

v19.0.1
- Translation updates

v19.0.0
- Changed test builds to 'Kodi 19 Matrix'
- Increased version to 19.0.0
Expand Down
9 changes: 6 additions & 3 deletions src/PVRDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,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 d957853

Please sign in to comment.