Skip to content
This repository
Browse code

Fix inf. loop in OnJumpLetter() after 9e16ec

  • Loading branch information...
commit 58d3e4d7b70f7d9f74aa3209775609af07fbc7e3 1 parent 2680e87
Trent Nelson authored October 02, 2012

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. 8  xbmc/guilib/GUIBaseContainer.cpp
8  xbmc/guilib/GUIBaseContainer.cpp
@@ -532,8 +532,9 @@ void CGUIBaseContainer::OnJumpLetter(char letter)
532 532
     return;
533 533
 
534 534
   // find the current letter we're focused on
535  
-  unsigned int offset = CorrectOffset(GetOffset(), GetCursor()) - 1;
536  
-  for (unsigned int i = (offset + 1) % m_items.size(); i != offset; i = (i+1) % m_items.size())
  535
+  unsigned int offset = CorrectOffset(GetOffset(), GetCursor());
  536
+  unsigned int i      = offset;
  537
+  do
537 538
   {
538 539
     CGUIListItemPtr item = m_items[i];
539 540
     if (0 == strnicmp(SortUtils::RemoveArticles(item->GetLabel()).c_str(), m_match.c_str(), m_match.size()))
@@ -541,7 +542,8 @@ void CGUIBaseContainer::OnJumpLetter(char letter)
541 542
       SelectItem(i);
542 543
       return;
543 544
     }
544  
-  }
  545
+    i = (i+1) % m_items.size();
  546
+  } while (i != offset);
545 547
   // no match found - repeat with a single letter
546 548
   if (m_match.size() > 1)
547 549
   {

1 note on commit 58d3e4d

Memphiz
Owner

And here is your "first git commit without wtf" award :)

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