Fix infinite loop while viewing "EPG: Timeline" window
authorGarrett Brown <garbearucla@gmail.com>
Tue, 8 Oct 2013 02:15:39 +0000 (19:15 -0700)
committerGarrett Brown <garbearucla@gmail.com>
Tue, 8 Oct 2013 02:15:39 +0000 (19:15 -0700)
With invalid begin/end times, the for loop in GUIEPGContainer.cpp L#825 (https://github.com/xbmc/xbmc/blob/5f33d290e/xbmc/epg/GUIEPGGridContainer.cpp#L825) loops endlessly, freezing XBMC when the user views the "EPG: Timeline" window. Solve this by adding check for invalid end times.

xbmc/pvr/windows/GUIWindowPVRGuide.cpp

index 198b074..1674e37 100644 (file)
@@ -242,7 +242,11 @@ void CGUIWindowPVRGuide::UpdateViewTimeline(bool bUpdateSelectedFile)
   CDateTime gridStart = CDateTime::GetCurrentDateTime().GetAsUTCDateTime();
   CDateTime firstDate(g_EpgContainer.GetFirstEPGDate());
   CDateTime lastDate(g_EpgContainer.GetLastEPGDate());
-  m_parent->m_guideGrid->SetStartEnd(firstDate > gridStart ? firstDate : gridStart, lastDate);
+  if (!firstDate.IsValid() || firstDate < gridStart)
+    firstDate = gridStart;
+  if (!lastDate.IsValid() || lastDate < firstDate)
+    lastDate = firstDate;
+  m_parent->m_guideGrid->SetStartEnd(firstDate, lastDate);
 
   m_parent->SetLabel(m_iControlButton, g_localizeStrings.Get(19222) + ": " + g_localizeStrings.Get(19032));
   m_parent->SetLabel(CONTROL_LABELGROUP, g_localizeStrings.Get(19032));