Skip to content

Commit

Permalink
added check when pbuffer_get_data returns error
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni committed Sep 28, 2023
1 parent b859fcd commit b1b6b27
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libraries/lwIpWrapper/src/lwipClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ int lwipClient::read()
uint8_t b;
if ((_tcp_client != NULL) && (_tcp_client->data.p != NULL)) {
__disable_irq();
pbuffer_get_data(&(_tcp_client->data), &b, 1);
int rv = pbuffer_get_data(&(_tcp_client->data), &b, 1);
__enable_irq();
return b;
if(rv == 1) {
return b;
} else {
return -1;
}
}
// No data available
return -1;
Expand Down

0 comments on commit b1b6b27

Please sign in to comment.