Skip to content

Commit c842977

Browse files
committed
Better error handling for parsePacket
1 parent fd67bf6 commit c842977

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/WiFi/src/WiFiUdp.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ int arduino::WiFiUDP::parsePacket() {
6767
if (ret == NSAPI_ERROR_WOULD_BLOCK) {
6868
// no data
6969
return 0;
70+
} else if(ret == NSAPI_ERROR_NO_SOCKET){
71+
// socket was not created correctly.
72+
return -1;
7073
}
7174
// error codes below zero are errors
7275
else if (ret <= 0) {
7376
// something else went wrong, need some tracing info...
74-
return 0;
77+
return -1;
7578
}
7679

7780
// set current packet states

0 commit comments

Comments
 (0)