From 98ceffa410220754ea90eb81a17d9e6c9502c875 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Thu, 18 Dec 2008 18:54:53 +0000 Subject: Disk cache: Avoid a crashing on a timer when the cache is disabled. Review URL: http://codereview.chromium.org/15025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7233 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/backend_impl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 710f8bd..af35041 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -682,9 +682,11 @@ void BackendImpl::OnStatsTimer() { stats_.SetCounter(Stats::MAX_ENTRIES, max_refs_); static bool first_time = true; + if (!data_) + first_time = false; if (first_time) { first_time = false; - int experiment = data_ ? data_->header.experiment : 1; + int experiment = data_->header.experiment; std::wstring entries(StringPrintf(L"DiskCache.Entries_%d", experiment)); std::wstring size(StringPrintf(L"DiskCache.Size_%d", experiment)); std::wstring max_size(StringPrintf(L"DiskCache.MaxSize_%d", experiment)); -- cgit v1.1