Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 12607011: Fix a crashing call to GURL::spec() in downloads_api.cc:DownloadItemToJSON() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r188114 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/downloads/downloads_api.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index 60831b9513a2d3dcc94bf9957d9bb7aaa3073306..fcf5d1b3336e78dcd5382e8f39d1ce63a7a21ec8 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -217,7 +217,8 @@ scoped_ptr<base::DictionaryValue> DownloadItemToJSON(
base::DictionaryValue* json = new base::DictionaryValue();
json->SetBoolean(kExistsKey, !download_item->GetFileExternallyRemoved());
json->SetInteger(kIdKey, download_item->GetId());
- json->SetString(kUrlKey, download_item->GetOriginalUrl().spec());
+ const GURL& url = download_item->GetOriginalUrl();
+ json->SetString(kUrlKey, (url.is_valid() ? url.spec() : ""));
json->SetString(
kFilenameKey, download_item->GetFullPath().LossyDisplayName());
json->SetString(kDangerKey, DangerString(download_item->GetDangerType()));
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698