Skip to content

Commit 01fc57f

Browse files
Merge pull request #184 from Longwater1234/copilot/fix-static-index-issue
Reset current_idx on publicServers shrink after refresh
2 parents d271509 + 3df8de4 commit 01fc57f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/WsClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ void WsClient::showPublicServerWindow(bool &showPublic)
9090
if (ImGui::Begin("Public Servers", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse))
9191
{
9292
static size_t current_idx{0};
93+
if (!publicServers.empty() && current_idx >= publicServers.size())
94+
{
95+
current_idx = 0;
96+
}
9397
if (ImGui::BeginListBox("Select One"))
9498
{
9599
for (size_t i = 0; i < publicServers.size(); ++i)

0 commit comments

Comments
 (0)