Merge pull request #15731 from unknownbrackets/reporting-crash

Reporting: Avoid crash if socket connect fails
This commit is contained in:
Henrik Rydgård 2022-07-27 07:43:30 +02:00 committed by GitHub
commit fc70d21d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -280,9 +280,11 @@ namespace Reporting
return false;
if (http.Resolve(serverHost, ServerPort())) {
http.Connect();
int result = http.POST(http::RequestParams(uri), data, mimeType, output, &progress);
http.Disconnect();
int result = -1;
if (http.Connect()) {
result = http.POST(http::RequestParams(uri), data, mimeType, output, &progress);
http.Disconnect();
}
return result >= 200 && result < 300;
} else {