Skip to content

Commit 8b1af68

Browse files
mayankgour13devyte
authored andcommitted
Infinite loop while passing File(FS.h) resolved (#5038)
Stream.available() never reaches to -1 which makes it an infinite loop. When File (FS.h) goes empty it reaches to 0 not -1.
1 parent ad2b51e commit 8b1af68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ int HTTPClient::sendRequest(const char * type, Stream * stream, size_t size)
761761

762762
if(buff) {
763763
// read all data from stream and send it to server
764-
while(connected() && (stream->available() > -1) && (len > 0 || len == -1)) {
764+
while(connected() && (stream->available() > 0) && (len > 0 || len == -1)) {
765765

766766
// get available data size
767767
int sizeAvailable = stream->available();

0 commit comments

Comments
 (0)