Skip to content
This repository
Browse code

clamp offset to valid range in CGUIEpgGridContainer::ScrollToBlockOff…

…set(), fixes #13660
  • Loading branch information...
commit f884cfc96c5899da022b03ffcb60617cc14ee5f0 1 parent 8ce3f48
Michal Piechowiak authored December 04, 2012

Showing 1 changed file with 4 additions and 10 deletions. Show diff stats Hide diff stats

  1. 14  xbmc/epg/GUIEPGGridContainer.cpp
14  xbmc/epg/GUIEPGGridContainer.cpp
@@ -901,16 +901,7 @@ void CGUIEPGGridContainer::ChannelScroll(int amount)
901 901
 void CGUIEPGGridContainer::ProgrammesScroll(int amount)
902 902
 {
903 903
   // increase or decrease the horizontal offset
904  
-  int offset = m_blockOffset + amount;
905  
-
906  
-  if (offset > m_blocks - m_blocksPerPage)
907  
-  {
908  
-    offset = m_blocks - m_blocksPerPage;
909  
-  }
910  
-
911  
-  if (offset < 0) offset = 0;
912  
-
913  
-  ScrollToBlockOffset(offset);
  904
+  ScrollToBlockOffset(m_blockOffset + amount);
914 905
 }
915 906
 
916 907
 bool CGUIEPGGridContainer::MoveChannel(bool direction, bool wrapAround)
@@ -1471,6 +1462,9 @@ void CGUIEPGGridContainer::ScrollToChannelOffset(int offset)
1471 1462
 
1472 1463
 void CGUIEPGGridContainer::ScrollToBlockOffset(int offset)
1473 1464
 {
  1465
+  // make sure offset is in valid range
  1466
+  offset = std::max(0, std::min(offset, m_blocks - m_blocksPerPage));
  1467
+
1474 1468
   float size = m_blockSize;
1475 1469
   int range = m_blocksPerPage / 1;
1476 1470
 

0 notes on commit f884cfc

Please sign in to comment.
Something went wrong with that request. Please try again.