aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2016-01-28 17:49:42 +0100
committerMartijn Kaijser <martijn@xbmc.org>2016-01-28 17:49:42 +0100
commit46175d68592c962ec3a67af484a6d127d672affe (patch)
tree1c028261c4b8302ea6168c595c8c51c706619566
parentad93e7ebaa25bee87d9aabeacef6bff7ac8704f3 (diff)
parente15ed4cf55e9715a761166902034d87f44badaee (diff)
Merge pull request #8962 from ksooo/jarvis-trac1653916.0rc2-Jarvis
[PVR] Fix crash after selecting 'Add timer' in PVR timer window, closes Trac16539
-rw-r--r--xbmc/pvr/addons/PVRClients.cpp14
-rw-r--r--xbmc/pvr/addons/PVRClients.h6
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.cpp2
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.cpp2
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRSearch.cpp2
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRTimers.cpp6
6 files changed, 29 insertions, 3 deletions
diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp
index 17e5e2c290..da39071205 100644
--- a/xbmc/pvr/addons/PVRClients.cpp
+++ b/xbmc/pvr/addons/PVRClients.cpp
@@ -1439,6 +1439,20 @@ bool CPVRClients::GetClient(const std::string &strId, AddonPtr &addon) const
return false;
}
+bool CPVRClients::SupportsTimers() const
+{
+ PVR_CLIENTMAP clients;
+ GetConnectedClients(clients);
+
+ for (const auto &entry : clients)
+ {
+ if (entry.second->SupportsTimers())
+ return true;
+ }
+
+ return false;
+}
+
bool CPVRClients::SupportsChannelGroups(int iClientId) const
{
PVR_CLIENT client;
diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h
index 03f5da1b44..7bd9b3a4af 100644
--- a/xbmc/pvr/addons/PVRClients.h
+++ b/xbmc/pvr/addons/PVRClients.h
@@ -323,6 +323,12 @@ namespace PVR
//@{
/*!
+ * @brief Check whether there is at least one connected client supporting timers.
+ * @return True if at least one connected client supports timers, false otherwise.
+ */
+ bool SupportsTimers() const;
+
+ /*!
* @brief Check whether a client supports timers.
* @param iClientId The id of the client to check.
* @return True if the supports timers, false otherwise.
diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
index 5d89d1e4c1..29fdf29908 100644
--- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
@@ -85,7 +85,7 @@ void CGUIWindowPVRChannels::GetContextButtons(int itemNumber, CContextButtons &b
if (channel->IsRecording())
buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */
- else
+ else if (g_PVRClients->SupportsTimers(channel->ClientID()))
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
if (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
index ad6e04b31d..baa75af4ca 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -101,7 +101,7 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt
buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */
}
}
- else if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
+ else if (g_PVRClients->SupportsTimers() && epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
{
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */
diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
index d782025773..f0786f7b4a 100644
--- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
@@ -67,7 +67,7 @@ void CGUIWindowPVRSearch::GetContextButtons(int itemNumber, CContextButtons &but
buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */
}
}
- else if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
+ else if (g_PVRClients->SupportsTimers() && epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
{
buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */
buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */
diff --git a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp
index bd5ea749a3..8c7093e1a2 100644
--- a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp
@@ -377,6 +377,12 @@ bool CGUIWindowPVRTimers::ActionDeleteTimer(CFileItem *item)
bool CGUIWindowPVRTimers::ActionShowTimer(CFileItem *item)
{
+ if (!g_PVRClients->SupportsTimers())
+ {
+ CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers."
+ return false;
+ }
+
bool bReturn = false;
/* Check if "Add timer..." entry is pressed by OK, if yes