We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d27e2f1 + 0c0a239 commit fdddc50Copy full SHA for fdddc50
src/diagnostics/src/WirelessDiags.cpp
@@ -134,8 +134,16 @@ float WirelessDiags::calcBitRate() {
134
135
// Convert string to int
136
string::size_type sz; // alias of size_t
137
- long int rx_bytes = stoi(receive_stat,&sz);
138
- long int tx_bytes = stoi(transmit_stat,&sz);
+ long int rx_bytes = 0;
+ long int tx_bytes = 0;
139
+ if (!receive_stat.empty())
140
+ {
141
+ rx_bytes = stoi(receive_stat,&sz);
142
+ }
143
+ if (!transmit_stat.empty())
144
145
+ tx_bytes = stoi(transmit_stat,&sz);
146
147
148
// Get the total bytes transmitted and recevied. This is the total bandwidth used.
149
total_bytes = rx_bytes + tx_bytes;
0 commit comments