Skip to content

Commit 2883503

Browse files
lucasssvazpull[bot]
authored andcommitted
WiFiClient - Properly initialize and check _rxBuffer (#8699)
1 parent 2ce43e3 commit 2883503

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: libraries/WiFi/src/WiFiClient.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class WiFiClientSocketHandle {
182182
}
183183
};
184184

185-
WiFiClient::WiFiClient():_connected(false),_timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS),next(NULL)
185+
WiFiClient::WiFiClient():_rxBuffer(nullptr),_connected(false),_timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS),next(NULL)
186186
{
187187
}
188188

@@ -508,7 +508,9 @@ int WiFiClient::available()
508508
// Though flushing means to send all pending data,
509509
// seems that in Arduino it also means to clear RX
510510
void WiFiClient::flush() {
511-
_rxBuffer->flush();
511+
if (_rxBuffer != nullptr) {
512+
_rxBuffer->flush();
513+
}
512514
}
513515

514516
uint8_t WiFiClient::connected()

0 commit comments

Comments
 (0)