From 7b811f9b3ad2200143f27b9a3cc5d8ba4131f041 Mon Sep 17 00:00:00 2001 From: FotoFieber Date: Mon, 19 Nov 2018 16:59:14 +0100 Subject: [PATCH] leave possible endless loop (#1986) --- libraries/HTTPClient/src/HTTPClient.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/HTTPClient/src/HTTPClient.cpp b/libraries/HTTPClient/src/HTTPClient.cpp index 5920bdfc..ffeada6b 100644 --- a/libraries/HTTPClient/src/HTTPClient.cpp +++ b/libraries/HTTPClient/src/HTTPClient.cpp @@ -1175,6 +1175,10 @@ int HTTPClient::writeToStreamDataBlock(Stream * stream, int size) if(readBytes > buff_size) { readBytes = buff_size; } + + // stop if no more reading + if (readBytes == 0) + break; // read data int bytesRead = _client->readBytes(buff, readBytes);