summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-17 17:26:19 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-17 17:26:19 -0600
commitc88e00f1edcb7fb61d783fb7f5d2e9c35f056146 (patch)
tree70542708dcc0885c85d9623bda920ae1838ee0cd /ui
parent874bf172268a100623abf32a0fda3db0c112e26a (diff)
downloadhorizon-c88e00f1edcb7fb61d783fb7f5d2e9c35f056146.tar.gz
horizon-c88e00f1edcb7fb61d783fb7f5d2e9c35f056146.tar.bz2
horizon-c88e00f1edcb7fb61d783fb7f5d2e9c35f056146.tar.xz
horizon-c88e00f1edcb7fb61d783fb7f5d2e9c35f056146.zip
Qt UI: Parse network information more correctly
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/netsimplewifipage.cc13
1 files changed, 8 insertions, 5 deletions
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);