From bde5f921eb6b3ea9666750fe8d4a89dec9084f79 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Wed, 17 Jul 2024 19:53:20 +0800 Subject: [PATCH] bug fixes --- selfdrive/ui/qt/offroad/software_settings.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/selfdrive/ui/qt/offroad/software_settings.cc b/selfdrive/ui/qt/offroad/software_settings.cc index c46a9f27a..e999ee3c2 100644 --- a/selfdrive/ui/qt/offroad/software_settings.cc +++ b/selfdrive/ui/qt/offroad/software_settings.cc @@ -64,12 +64,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { connect(targetBranchBtn, &ButtonControl::clicked, [=]() { auto current = params.get("GitBranch"); QStringList branches = QString::fromStdString(params.get("UpdaterAvailableBranches")).split(","); - if (!branches.isEmpty()) { - QString current = QString::fromStdString(params.get("CurrentBranch")); - int currentIndex = branches.indexOf(current); - if (currentIndex >= 0) { - branches.removeAt(currentIndex); - branches.insert(0, current); + for (QString b : {current.c_str()}) { + auto i = branches.indexOf(b); + if (i >= 0) { + branches.removeAt(i); + branches.insert(0, b); } }