Unverified Commit aa529eb5 authored by wadim's avatar wadim Committed by GitHub

Fix getString() freeze on empty responses (#4317)

parent a9cb7c6d
...@@ -921,13 +921,16 @@ String HTTPClient::getString(void) ...@@ -921,13 +921,16 @@ String HTTPClient::getString(void)
{ {
StreamString sstring; StreamString sstring;
if(_size) { if(_size > 0) {
// try to reserve needed memmory // try to reserve needed memmory
if(!sstring.reserve((_size + 1))) { if(!sstring.reserve((_size + 1))) {
log_d("not enough memory to reserve a string! need: %d", (_size + 1)); log_d("not enough memory to reserve a string! need: %d", (_size + 1));
return ""; return "";
} }
} }
else {
return "";
}
writeToStream(&sstring); writeToStream(&sstring);
return sstring; return sstring;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment