From 35fa41cbfd513178ede2e059dc6d628bac556d0b Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Thu, 10 Sep 2009 21:25:48 +0100 Subject: [PATCH] Bug 515288 - Crash with getScreenCTM() on outer svg with no current document. r=roc --- layout/svg/base/src/nsSVGUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 1990e5a83ca..a4e0a570292 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -546,9 +546,9 @@ nsSVGUtils::GetCTM(nsSVGElement *aElement, PRBool aScreenCTM) // XXX this does not take into account CSS transform, or that the non-SVG // content that we've hit may itself be inside an SVG foreignObject higher up float x = 0.0f, y = 0.0f; - if (element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) { + if (currentDoc && element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) { nsIPresShell *presShell = currentDoc->GetPrimaryShell(); - if (element && presShell) { + if (presShell) { nsPresContext *context = presShell->GetPresContext(); if (context) { nsIFrame* frame = presShell->GetPrimaryFrameFor(element);