Bug 778442 - Add some null guards in nsPluginInstanceOwner::GetVisibleRect r=blassey
authorJames Willcox <jwillcox@mozilla.com>
Tue, 11 Sep 2012 10:20:44 -0400
changeset 106806 8bebc4a081795f3569932b4051e3ec4960f2981b
parent 106805 f50654b6b00a42ddae340a3f8e72004f0764566c
child 106807 ef085eb72cd8021f10ab6c2deb28db0cee92a795
push id23448
push userryanvm@gmail.com
push dateWed, 12 Sep 2012 01:39:22 +0000
treeherdermozilla-central@6e78c3efd115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs778442
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 778442 - Add some null guards in nsPluginInstanceOwner::GetVisibleRect r=blassey
dom/plugins/base/nsPluginInstanceOwner.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1801,16 +1801,19 @@ already_AddRefed<ImageContainer> nsPlugi
   pluginImage->SetData(data);
   container->SetCurrentImageInTransaction(img);
 
   return container.forget();
 }
 
 nsIntRect nsPluginInstanceOwner::GetVisibleRect()
 {
+  if (!mObjectFrame || !mPluginWindow)
+    return nsIntRect(0, 0, 0, 0);
+  
   gfxRect r = nsIntRect(0, 0, mPluginWindow->width, mPluginWindow->height);
 
   float xResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetXResolution();
   float yResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetYResolution();
   r.Scale(xResolution, yResolution);
 
   return nsIntRect(r.x, r.y, r.width, r.height);
 }