Skip to content

Commit

Permalink
Merge pull request #25186 from ksooo/pvr-fix-timer-settings-channel-s…
Browse files Browse the repository at this point in the history
…election

[PVR] Timer settings dialog: Fix selection of current channel, …
  • Loading branch information
ksooo committed May 11, 2024
2 parents 426d10d + c55e5e5 commit f22629f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,31 @@ void CGUIDialogPVRTimerSettings::ChannelsFiller(const SettingConstPtr& setting,
foundCurrent = true;
}
}

if (foundCurrent)
{
// Verify m_channel is still valid. Update if not.
if (std::find_if(list.cbegin(), list.cend(),
[&current](const auto& channel)
{ return channel.value == current; }) == list.cend())
{
// Set m_channel and current to first valid channel in list
const int first{list.front().value};
const auto it =
std::find_if(pThis->m_channelEntries.cbegin(), pThis->m_channelEntries.cend(),
[first](const auto& channel) { return channel.first == first; });

if (it != pThis->m_channelEntries.cend())
{
current = (*it).first;
pThis->m_channel = (*it).second;
}
else
{
CLog::LogF(LOGERROR, "Unable to find channel to select");
}
}
}
}
else
CLog::LogF(LOGERROR, "No dialog");
Expand Down

0 comments on commit f22629f

Please sign in to comment.