Fix getString() freeze on empty responses (#4317)
This commit is contained in:
parent
a9cb7c6d6f
commit
aa529eb5a0
@ -921,13 +921,16 @@ String HTTPClient::getString(void)
|
||||
{
|
||||
StreamString sstring;
|
||||
|
||||
if(_size) {
|
||||
if(_size > 0) {
|
||||
// try to reserve needed memmory
|
||||
if(!sstring.reserve((_size + 1))) {
|
||||
log_d("not enough memory to reserve a string! need: %d", (_size + 1));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
|
||||
writeToStream(&sstring);
|
||||
return sstring;
|
||||
|
Loading…
Reference in New Issue
Block a user