Skip to content

Commit

Permalink
Catch a possible null-dereference (#8508)
Browse files Browse the repository at this point in the history
  • Loading branch information
einglis committed Mar 13, 2022
1 parent a736a95 commit 732db59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
}

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) {
WiFiUDP::stopAll();
Expand Down

0 comments on commit 732db59

Please sign in to comment.