Commit 1e46ff62 authored by tzik@chromium.org's avatar tzik@chromium.org

Handle invalid usage cache file path

usage_file_path can be empty when a FileSystem is accessed after DeleteFileSystem call.

BUG=


Review URL: https://chromiumcodereview.appspot.com/10832316

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151692 0039d316-1c4b-4281-b951-d872f2087c98
parent e059844f
......@@ -130,9 +130,9 @@ int64 FileSystemUsageCache::Read(const FilePath& usage_file_path,
uint32* dirty) {
char buffer[kUsageFileSize];
const char *header;
DCHECK(!usage_file_path.empty());
if (kUsageFileSize !=
file_util::ReadFile(usage_file_path, buffer, kUsageFileSize))
if (usage_file_path.empty() ||
kUsageFileSize != file_util::ReadFile(usage_file_path,
buffer, kUsageFileSize))
return -1;
Pickle read_pickle(buffer, kUsageFileSize);
PickleIterator iter(read_pickle);
......@@ -164,9 +164,9 @@ int FileSystemUsageCache::Write(const FilePath& usage_file_path,
write_pickle.WriteUInt32(dirty);
write_pickle.WriteInt64(fs_usage);
DCHECK(!usage_file_path.empty());
FilePath temporary_usage_file_path;
if (!file_util::CreateTemporaryFileInDir(usage_file_path.DirName(),
if (usage_file_path.empty() ||
!file_util::CreateTemporaryFileInDir(usage_file_path.DirName(),
&temporary_usage_file_path)) {
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment