From f8b683ca3d1095c3a9c187bc2ced9ffd24de0d4f Mon Sep 17 00:00:00 2001 From: Ales Pergl Date: Mon, 27 Nov 2017 17:55:21 +0100 Subject: [PATCH] Don't access unique pointer after it was moved from --- .../browser/inspectable_web_contents_impl.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 874215f7d917..4d0826990c8c 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -800,16 +800,21 @@ void InspectableWebContentsImpl::OnURLFetchComplete( DCHECK(it != pending_requests_.end()); base::DictionaryValue response; - auto headers = base::MakeUnique(); + net::HttpResponseHeaders* rh = source->GetResponseHeaders(); response.SetInteger("statusCode", rh ? rh->response_code() : 200); - response.Set("headers", std::move(headers)); - size_t iterator = 0; - std::string name; - std::string value; - while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) - headers->SetString(name, value); + { + auto headers = base::MakeUnique(); + + size_t iterator = 0; + std::string name; + std::string value; + 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);