Index: net/disk_cache/simple/simple_index_file.cc |
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc |
index 529faf15a1ed1c71ecb6a616f3c5480134dfc2b6..319352080c2a339745c7e56637c7b59f426b3b93 100644 |
--- a/net/disk_cache/simple/simple_index_file.cc |
+++ b/net/disk_cache/simple/simple_index_file.cc |
@@ -178,10 +178,18 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::LoadFromDisk( |
std::string contents; |
if (!file_util::ReadFileToString(index_filename, &contents)) { |
LOG(WARNING) << "Could not read Simple Index file."; |
+ file_util::Delete(index_filename, false); |
return scoped_ptr<SimpleIndex::EntrySet>(); |
} |
- return SimpleIndexFile::Deserialize(contents.data(), contents.size()); |
+ scoped_ptr<SimpleIndex::EntrySet> entries = |
+ SimpleIndexFile::Deserialize(contents.data(), contents.size()); |
+ if (!entries) { |
+ file_util::Delete(index_filename, false); |
+ return scoped_ptr<SimpleIndex::EntrySet>(); |
+ } |
+ |
+ return entries.Pass(); |
} |
// static |