summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);