Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Omega][PVR] Timer settings dialog: Fix selection of current channel, for ex… #25190

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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