From c88e00f1edcb7fb61d783fb7f5d2e9c35f056146 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 17 Nov 2019 17:26:19 -0600 Subject: Qt UI: Parse network information more correctly --- ui/qt5/netsimplewifipage.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ui/qt5') diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc index f595d11..aa4bb20 100644 --- a/ui/qt5/netsimplewifipage.cc +++ b/ui/qt5/netsimplewifipage.cc @@ -189,23 +189,26 @@ int NetworkSimpleWirelessPage::processScan(wpactrl_t *c, const char *, size_t) { std::string net_line(buf); std::string::size_type cur = 0, next = net_line.find_first_of('\t'); assert(next != std::string::npos); - std::string bssid(net_line.substr(cur, next)); + std::string bssid(net_line.substr(cur, next - cur)); cur = next + 1; next = net_line.find_first_of('\t', cur); assert(next != std::string::npos); - std::string freq(net_line.substr(cur, next)); + std::string freq(net_line.substr(cur, next - cur)); cur = next + 1; next = net_line.find_first_of('\t', cur); assert(next != std::string::npos); - std::string signal(net_line.substr(cur, next)); + std::string signal(net_line.substr(cur, next - cur)); cur = next + 1; next = net_line.find_first_of('\t', cur); assert(next != std::string::npos); - std::string flags(net_line.substr(cur, next)); + std::string flags(net_line.substr(cur, next - cur)); cur = next + 1; next = net_line.find_first_of('\t', cur); assert(next == std::string::npos); - std::string ssid(net_line.substr(cur, next)); + std::string ssid(net_line.substr(cur)); + + /* Don't bother with empty SSIDs. */ + if(ssid.empty()) continue; QIcon icon; int strength = std::stoi(signal); -- cgit v1.2.3-60-g2f50