fixed: #10841 - Control.SetFocus(id,position) failed for position > items.size()
authorjmarshallnz <jmarshallnz@svn>
Mon, 6 Dec 2010 07:28:26 +0000 (07:28 +0000)
committerjmarshallnz <jmarshallnz@svn>
Mon, 6 Dec 2010 07:28:26 +0000 (07:28 +0000)
(cherry picked from commit 3fc4ef73814f62bce7f619487ffa6e87ad30be01)

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@35582 568bbfeb-2a22-0410-94d2-cc84cf5bfa90

guilib/GUIListContainer.cpp

index f37fc7e..306f9ce 100644 (file)
@@ -126,7 +126,10 @@ bool CGUIListContainer::OnMessage(CGUIMessage& message)
     else if (message.GetMessage() == GUI_MSG_SETFOCUS)
     {
       if (message.GetParam1()) // subfocus item is specified, so set the offset appropriately
-        m_cursor = (int)message.GetParam1() - 1;
+      {
+        int item = std::min(m_offset + (int)message.GetParam1() - 1, (int)m_items.size() - 1);
+        SelectItem(item);
+      }
     }
   }
   return CGUIBaseContainer::OnMessage(message);