summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 22:33:25 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 22:33:25 +0000
commit4a210ecd52feb4f61969f329c5bd10b5746c6e2b (patch)
tree4c84549888df5c615d2bead1fa12d6fe28c7756a /chrome
parent387bb2e928e7b9ef4ac701ff51426d75ad9ce572 (diff)
downloadchromium_src-4a210ecd52feb4f61969f329c5bd10b5746c6e2b.zip
chromium_src-4a210ecd52feb4f61969f329c5bd10b5746c6e2b.tar.gz
chromium_src-4a210ecd52feb4f61969f329c5bd10b5746c6e2b.tar.bz2
Crash fix for handling invalid feed parent/child relationship.
BUG=chromium-os:28106 TEST=none Review URL: https://chromiumcodereview.appspot.com/9769003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index 803d231..0d878fc 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -1994,16 +1994,28 @@ base::PlatformFileError GDataFileSystem::UpdateDirectoryWithDocumentFeed(
for (UrlToFileAndParentMap::iterator it = file_by_url.begin();
it != file_by_url.end(); ++it) {
- GDataFileBase* file = it->second.first;
+ scoped_ptr<GDataFileBase> file(it->second.first);
GURL parent_url = it->second.second;
GDataDirectory* dir = root_.get();
if (!parent_url.is_empty()) {
- DCHECK(file_by_url.find(parent_url) != file_by_url.end());
- dir = file_by_url[parent_url].first->AsGDataDirectory();
+ UrlToFileAndParentMap::iterator find_iter = file_by_url.find(parent_url);
+ if (find_iter == file_by_url.end()) {
+ LOG(WARNING) << "Found orphaned file '" << file->file_name()
+ << "' with non-existing parent folder of "
+ << parent_url.spec();
+ } else {
+ dir = find_iter->second.first->AsGDataDirectory();
+ if (!dir) {
+ LOG(WARNING) << "Found orphaned file '" << file->file_name()
+ << "' pointing to non directory parent "
+ << parent_url.spec();
+ dir = root_.get();
+ }
+ }
}
DCHECK(dir);
- dir->AddFile(file);
+ dir->AddFile(file.release());
}
NotifyDirectoryChanged(root_->GetFilePath());