diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 3040cbb39bff..f5984d6f7263 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -284,16 +284,15 @@ nsSVGGlyphFrame::Init(nsPresContext* aPresContext, } nsCOMPtr renderer; outerSVGFrame->GetRenderer(getter_AddRefs(renderer)); - if (!renderer) return NS_ERROR_FAILURE; - - renderer->CreateGlyphMetrics(this, getter_AddRefs(mMetrics)); - if (!mMetrics) return NS_ERROR_FAILURE; - - renderer->CreateGlyphGeometry(this, getter_AddRefs(mGeometry)); - if (!mGeometry) return NS_ERROR_FAILURE; - + if (renderer) { + renderer->CreateGlyphMetrics(this, getter_AddRefs(mMetrics)); + renderer->CreateGlyphGeometry(this, getter_AddRefs(mGeometry)); + } SetStyleContext(aPresContext, aContext); + + if (!renderer || !mMetrics || !mGeometry) + return NS_ERROR_FAILURE; return NS_OK; }