Skip to content

Commit 13947c2

Browse files
committed
SocketWrapper MbedClient stopped client read() crash fix
1 parent 0108ded commit 13947c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/SocketWrapper/src/MbedClient.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ int arduino::MbedClient::available() {
229229
}
230230

231231
int arduino::MbedClient::read() {
232+
if (sock == nullptr)
233+
return -1;
232234
mutex->lock();
233235
if (!available()) {
234236
mutex->unlock();
@@ -241,6 +243,8 @@ int arduino::MbedClient::read() {
241243
}
242244

243245
int arduino::MbedClient::read(uint8_t *data, size_t len) {
246+
if (sock == nullptr)
247+
return -1;
244248
mutex->lock();
245249
int avail = available();
246250

0 commit comments

Comments
 (0)