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())); |