1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Catch a possible null-dereference (#8508)

This commit is contained in:
Edd Inglis 2022-03-13 21:34:42 +00:00 committed by GitHub
parent a736a95655
commit 732db59492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,6 +254,12 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
} }
WiFiClient * tcp = http.getStreamPtr(); WiFiClient * tcp = http.getStreamPtr();
if (!tcp) {
DEBUG_HTTP_UPDATE("[httpUpdate] WiFiClient connection unexpectedly absent\n");
_setLastError(HTTPC_ERROR_CONNECTION_LOST);
http.end();
return HTTP_UPDATE_FAILED;
}
if (_closeConnectionsOnUpdate) { if (_closeConnectionsOnUpdate) {
WiFiUDP::stopAll(); WiFiUDP::stopAll();