@@ -49,22 +49,31 @@ HTTPUpdate::~HTTPUpdate(void)
4949HTTPUpdateResult HTTPUpdate::update (WiFiClient& client, const String& url, const String& currentVersion)
5050{
5151 HTTPClient http;
52- http.begin (client, url);
52+ if (!http.begin (client, url))
53+ {
54+ return HTTP_UPDATE_FAILED;
55+ }
5356 return handleUpdate (http, currentVersion, false );
5457}
5558
5659HTTPUpdateResult HTTPUpdate::updateSpiffs (WiFiClient& client, const String& url, const String& currentVersion)
5760{
5861 HTTPClient http;
59- http.begin (client, url);
62+ if (!http.begin (client, url))
63+ {
64+ return HTTP_UPDATE_FAILED;
65+ }
6066 return handleUpdate (http, currentVersion, true );
6167}
6268
6369HTTPUpdateResult HTTPUpdate::update (WiFiClient& client, const String& host, uint16_t port, const String& uri,
6470 const String& currentVersion)
6571{
6672 HTTPClient http;
67- http.begin (client, host, port, uri);
73+ if (!http.begin (client, host, port, uri))
74+ {
75+ return HTTP_UPDATE_FAILED;
76+ }
6877 return handleUpdate (http, currentVersion, false );
6978}
7079
0 commit comments