summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--netwerk/cache/nsCacheEntryDescriptor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp
index b53ee3058..64765f8aa 100644
--- a/netwerk/cache/nsCacheEntryDescriptor.cpp
+++ b/netwerk/cache/nsCacheEntryDescriptor.cpp
@@ -1399,6 +1399,12 @@ nsCompressOutputStreamWrapper::Close()
// Do not allow to initialize stream after calling Close().
mStreamEnded = true;
+ // In some rare cases, flushing the zlib stream can take too long
+ // and we lose our cache entry in the meantime. Do another check
+ // and bail if so.
+ if (!mDescriptor)
+ return NS_ERROR_NOT_AVAILABLE;
+
if (mDescriptor->CacheEntry()) {
nsAutoCString uncompressedLenStr;
rv = mDescriptor->GetMetaDataElement("uncompressed-len",