Skip to content

Commit

Permalink
SocketWrapper MbedClient stopped client read() crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JAndrassy committed Jun 16, 2024
1 parent 0108ded commit fab0676
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/SocketWrapper/src/MbedClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ int arduino::MbedClient::available() {
}

int arduino::MbedClient::read() {
if (sock == nullptr)
return -1;
mutex->lock();
if (!available()) {
mutex->unlock();
Expand All @@ -241,6 +243,8 @@ int arduino::MbedClient::read() {
}

int arduino::MbedClient::read(uint8_t *data, size_t len) {
if (sock == nullptr)
return 0;
mutex->lock();
int avail = available();

Expand Down

0 comments on commit fab0676

Please sign in to comment.