Fix several potential null pointers

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-04-15 08:34:44 -04:00
parent eb9358f440
commit dbd677e6e7
4 changed files with 49 additions and 21 deletions

View File

@@ -315,7 +315,10 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
// if the status is anything but 3, there are no connections open
waitResponse(); // Returns an OK after the status
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
sockets[muxNo]->sock_connected = false;
GsmClientESP8266* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = false;
}
}
return false;
}
@@ -336,7 +339,10 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
if (has_status == 2) break; // once we get to the ok, stop
}
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
sockets[muxNo]->sock_connected = verified_connections[muxNo];
GsmClientESP8266* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = verified_connections[muxNo];
}
}
return verified_connections[mux];
}