summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 00:34:43 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 00:34:43 +0000
commit15ab7409218f0bed6e0f448b8707fcfc68ef26bb (patch)
treefd8e68cf483e0d80ca6645f5236d39fa03b5b097 /chrome/browser/bookmarks
parent7db6002e2322817d245227b53aa3b3e4bd7212af (diff)
downloadchromium_src-15ab7409218f0bed6e0f448b8707fcfc68ef26bb.zip
chromium_src-15ab7409218f0bed6e0f448b8707fcfc68ef26bb.tar.gz
chromium_src-15ab7409218f0bed6e0f448b8707fcfc68ef26bb.tar.bz2
Fix for crash when a bookmark URL is an empty string
BUG=19852 TEST=See repro steps of the bug Patch by Bruno Calvignac <BrunoCalvignac@gmail.com> Original CL http://codereview.chromium.org/282004 Review URL: http://codereview.chromium.org/342046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r--chrome/browser/bookmarks/bookmark_codec.cc5
-rw-r--r--chrome/browser/bookmarks/bookmark_storage.cc5
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc
index ff926f9..0ed7d5d 100644
--- a/chrome/browser/bookmarks/bookmark_codec.cc
+++ b/chrome/browser/bookmarks/bookmark_codec.cc
@@ -237,8 +237,9 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value,
if (!value.GetString(kURLKey, &url_string))
return false;
- if (!node)
- node = new BookmarkNode(id, GURL(WideToUTF8(url_string)));
+ GURL url = GURL(WideToUTF8(url_string));
+ if (!node && url.is_valid())
+ node = new BookmarkNode(id, url);
else
return false; // Node invalid.
diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc
index fb629a9..10f79ff 100644
--- a/chrome/browser/bookmarks/bookmark_storage.cc
+++ b/chrome/browser/bookmarks/bookmark_storage.cc
@@ -81,7 +81,7 @@ class BookmarkStorage::LoadTask : public Task {
scoped_ptr<Value> root(serializer.Deserialize(NULL));
if (root.get()) {
- // Building the index cane take a while, so we do it on the background
+ // Building the index can take a while, so we do it on the background
// thread.
int64 max_node_id = 0;
BookmarkCodec codec;
@@ -116,7 +116,8 @@ class BookmarkStorage::LoadTask : public Task {
// Adds node to the model's index, recursing through all children as well.
void AddBookmarksToIndex(BookmarkNode* node) {
if (node->is_url()) {
- details_->index()->Add(node);
+ if (node->GetURL().is_valid())
+ details_->index()->Add(node);
} else {
for (int i = 0; i < node->GetChildCount(); ++i)
AddBookmarksToIndex(node->GetChild(i));