Skip to content

Commit

Permalink
Fixed infinite navigation problem
Browse files Browse the repository at this point in the history
Fixes #158
  • Loading branch information
justalemon committed May 24, 2024
1 parent c0dd52f commit 50bac98
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions LemonUI/Menus/NativeMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1801,10 +1801,16 @@ public void Previous()
return;
}

int nextIndex = SelectedIndex;
int initialIndex = SelectedIndex;
int nextIndex = initialIndex;

while (true)
{
if (nextIndex == initialIndex)
{
return;
}

nextIndex -= 1;

if (nextIndex < 0)
Expand Down Expand Up @@ -1837,10 +1843,16 @@ public void Next()
return;
}

int nextIndex = SelectedIndex;
int initialIndex = SelectedIndex;
int nextIndex = initialIndex;

while (true)
{
if (nextIndex == initialIndex)
{
return;
}

nextIndex += 1;

if (nextIndex >= Items.Count)
Expand Down

0 comments on commit 50bac98

Please sign in to comment.