aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2024-05-09 23:01:55 +0200
committerksooo <3226626+ksooo@users.noreply.github.com>2024-05-10 22:48:11 +0200
commitc55e5e51e4dda2ae40048c0feb0dd41019a25045 (patch)
tree17b3a1aed90765690b4d0a4d70c44de3dd08512d
parent64e0ecf2f3d0a6011f97067f0922605bc14e453b (diff)
downloadxbmc-c55e5e51e4dda2ae40048c0feb0dd41019a25045.tar.xz
[PVR] Timer settings dialog: Fix selection of current channel, for example on change of client due to selection of another timer type.
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
index ad32612384..320c74dd4f 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
+++ b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
@@ -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");