Bug 1395938 - Prevent crash when we are missing an IOThread during shutdown r=michal draft
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 06 Sep 2017 19:18:24 +0200
changeset 660191 37423aef0a428825e65ebad777a93266038e220a
parent 659710 b235fb79d6e017b9f47309cb06eb701c06b7e8d2
child 730153 68d8dea258de5a4d523753e7082b8b241ba98b8f
push id78311
push uservalentin.gosu@gmail.com
push dateWed, 06 Sep 2017 17:20:33 +0000
reviewersmichal
bugs1395938
milestone57.0a1
Bug 1395938 - Prevent crash when we are missing an IOThread during shutdown r=michal MozReview-Commit-ID: 4iuMoHMTzia
netwerk/cache2/CacheStorageService.cpp
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -2030,17 +2030,20 @@ CacheStorageService::GetCacheEntryInfo(C
                          fetchCount, lastModified, expirationTime,
                          aEntry->IsPinned(), info);
 }
 
 // static
 uint32_t CacheStorageService::CacheQueueSize(bool highPriority)
 {
   RefPtr<CacheIOThread> thread = CacheFileIOManager::IOThread();
-  MOZ_ASSERT(thread);
+  // The thread will be null at shutdown.
+  if (!thread) {
+    return 0;
+  }
   return thread->QueueSize(highPriority);
 }
 
 // Telemetry collection
 
 namespace {
 
 bool TelemetryEntryKey(CacheEntry const* entry, nsAutoCString& key)