From 4427ad14518754c3f59f5a646a2286d936a5e24f Mon Sep 17 00:00:00 2001 From: Zach Halpern Date: Thu, 28 Feb 2019 00:34:12 -0500 Subject: [PATCH] Don't use hardcoded index Signed-off-by: Zach Halpern --- cockatrice/src/dlg_connect.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/dlg_connect.cpp b/cockatrice/src/dlg_connect.cpp index 2a39b4e1..8f676a77 100644 --- a/cockatrice/src/dlg_connect.cpp +++ b/cockatrice/src/dlg_connect.cpp @@ -190,17 +190,20 @@ void DlgConnect::rebuildComboBoxList(int failure) UserConnection_Information uci; savedHostList = uci.getServerInfo(); + int index = 0; for (const auto &pair : savedHostList) { auto tmp = pair.second; QString saveName = tmp.getSaveName(); if (saveName.size()) { previousHosts->addItem(saveName); - } - } - // On rebuild, set to RR - if (previousHosts->count() >= 2) { - previousHosts->setCurrentIndex(1); + // On rebuild, set to RR + if (saveName.compare("Rooster Ranges") == 0) { + previousHosts->setCurrentIndex(index); + } + + ++index; + } } btnRefreshServers->setDisabled(false);