Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9202 from WamWooWam/patch-http-requests
Fix logger related crash when HTTP response is empty.
  • Loading branch information
leoetlino committed Oct 29, 2020
2 parents 650638c + 72e1131 commit f665dda
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Source/Core/Common/HttpRequest.cpp
Expand Up @@ -221,8 +221,16 @@ HttpRequest::Response HttpRequest::Impl::Fetch(const std::string& url, Method me
curl_easy_getinfo(m_curl.get(), CURLINFO_RESPONSE_CODE, &response_code);
if (response_code != 200)
{
ERROR_LOG_FMT(COMMON, "Failed to {} {}: server replied with code {} and body\n\x1b[0m{:.{}}",
type, url, response_code, buffer.data(), static_cast<int>(buffer.size()));
if (buffer.empty())
{
ERROR_LOG_FMT(COMMON, "Failed to {} {}: server replied with code {}", type, url,
response_code);
}
else
{
ERROR_LOG_FMT(COMMON, "Failed to {} {}: server replied with code {} and body\n\x1b[0m{:.{}}",
type, url, response_code, buffer.data(), static_cast<int>(buffer.size()));
}
return {};
}

Expand Down

0 comments on commit f665dda

Please sign in to comment.