This commit is contained in:
Alayan-stk-2
2018-05-06 22:26:21 +02:00
committed by Deve
parent 267dfde46f
commit 20d36b6f1b

View File

@@ -1099,14 +1099,14 @@ bool DynamicRibbonWidget::setSelection(int item_id, const int playerID,
int row;
int id;
int iterations = 0; // a safeguard to avoid infinite loops (should not happen normally)
unsigned int iterations = 0; // a safeguard to avoid infinite loops (should not happen normally)
while (!findItemInRows(name.c_str(), &row, &id))
{
// if we get here it means the item is scrolled out. Try to find it.
scroll(1, evenIfDeactivated);
if (iterations > 50)
if (iterations > m_items.size())
{
Log::error("DynamicRibbonWidget::setSelection", "Cannot find item %d (%s)", item_id, name.c_str());
return false;