Bug 587494: Check whether our ExternalResource has a viewer before calling Hide() on it, to fix null-crash. r=roc a=blocking
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sun, 15 Aug 2010 15:49:21 -0700
changeset 50640 0074c4f2d5613fce33517662d8c1a95b1595e966
parent 50639 5e9c05dbe8d6a2165e0112cba51068abbc1a3b96
child 50641 420973cfb89d05d9f2529c2829890ba34c5ff1e0
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking
bugs587494
milestone2.0b4pre
Bug 587494: Check whether our ExternalResource has a viewer before calling Hide() on it, to fix null-crash. r=roc a=blocking
content/base/src/nsDocument.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -821,17 +821,19 @@ nsExternalResourceMap::Traverse(nsCycleC
   mMap.EnumerateRead(ExternalResourceTraverser, aCallback);
 }
 
 static PLDHashOperator
 ExternalResourceHider(nsIURI* aKey,
                       nsExternalResourceMap::ExternalResource* aData,
                       void* aClosure)
 {
-  aData->mViewer->Hide();
+  if (aData->mViewer) {
+    aData->mViewer->Hide();
+  }
   return PL_DHASH_NEXT;
 }
 
 void
 nsExternalResourceMap::HideViewers()
 {
   mMap.EnumerateRead(ExternalResourceHider, nsnull);
 }