Skip to content

Commit

Permalink
[PVR] Timer settings dialog: Fix selection of current channel, for ex…
Browse files Browse the repository at this point in the history
…ample on change of client due to selection of another timer type.
  • Loading branch information
ksooo committed May 10, 2024
1 parent 64e0ecf commit c55e5e5
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 c55e5e5

Please sign in to comment.