From d2b48b2aa7ff7ed3bb257f96ef0ed6d46c4c28b9 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 24 Feb 2016 14:01:26 +0100 Subject: [PATCH] Fix crash in mate::Converter::ToV8 The net::URLRequest::url() method calls vector::back(), which is undefined when the url_chain is empty --- atom/common/native_mate_converters/net_converter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/common/native_mate_converters/net_converter.cc b/atom/common/native_mate_converters/net_converter.cc index 94081b88a3d9..184f1c3fecff 100644 --- a/atom/common/native_mate_converters/net_converter.cc +++ b/atom/common/native_mate_converters/net_converter.cc @@ -27,7 +27,9 @@ v8::Local Converter::ToV8( v8::Isolate* isolate, const net::URLRequest* val) { scoped_ptr dict(new base::DictionaryValue); dict->SetString("method", val->method()); - dict->SetStringWithoutPathExpansion("url", val->url().spec()); + std::string url; + if (!val->url_chain().empty()) url = val->url().spec(); + dict->SetStringWithoutPathExpansion("url", url); dict->SetString("referrer", val->referrer()); scoped_ptr list(new base::ListValue); atom::GetUploadData(list.get(), val);