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

@@ -672,7 +672,13 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
}
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
// +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state>
sockets[muxNo]->sock_connected = stream.parseInt();
bool thisMuxState = stream.parseInt();
// Need to make sure a socket instace for the socket number exists
// before setting its state
GsmClientSim7600* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = thisMuxState;
}
}
waitResponse(); // Should be an OK at the end
return sockets[mux]->sock_connected;