Don't access unique pointer after it was moved from

This commit is contained in:
Ales Pergl 2017-11-27 17:55:21 +01:00
Родитель df0c7e2f74
Коммит f8b683ca3d
1 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -800,10 +800,12 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
DCHECK(it != pending_requests_.end());
base::DictionaryValue response;
auto headers = base::MakeUnique<base::DictionaryValue>();
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
response.Set("headers", std::move(headers));
{
auto headers = base::MakeUnique<base::DictionaryValue>();
size_t iterator = 0;
std::string name;
@ -811,6 +813,9 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
headers->SetString(name, value);
response.Set("headers", std::move(headers));
}
it->second.Run(&response);
pending_requests_.erase(it);
delete source;