Skip to content

Commit

Permalink
ui/networking: call isTetheringEnabled out of the loop (commaai#29028)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Jul 19, 2023
1 parent 7a5dbe6 commit 4584e88
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion selfdrive/ui/qt/offroad/networking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ void WifiUI::refresh() {
scanningLabel->setVisible(is_empty);
if (is_empty) return;

const bool is_tethering_enabled = wifi->isTetheringEnabled();
QList<Network> sortedNetworks = wifi->seenNetworks.values();
std::sort(sortedNetworks.begin(), sortedNetworks.end(), compare_by_strength);

Expand Down Expand Up @@ -313,7 +314,7 @@ void WifiUI::refresh() {
}

// Forget button
if (wifi->isKnownConnection(network.ssid) && !wifi->isTetheringEnabled()) {
if (wifi->isKnownConnection(network.ssid) && !is_tethering_enabled) {
QPushButton *forgetBtn = new QPushButton(tr("FORGET"));
forgetBtn->setObjectName("forgetBtn");
QObject::connect(forgetBtn, &QPushButton::clicked, [=]() {
Expand Down

0 comments on commit 4584e88

Please sign in to comment.