diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp
index 8eabc8ebb26..d73a33f05da 100644
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -2290,6 +2290,10 @@ ComputeLineHeight(nsIPresContext* aPresContext,
nsCOMPtr fm;
deviceContext->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
+ if (!fm) {
+ NS_WARNING( "null font metrics for the device context - we have to fix this someday...");
+ }
+
if (unit == eStyleUnit_Factor) {
// For factor units the computed value of the line-height property
// is found by multiplying the factor by the font's actual
@@ -2303,7 +2307,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
// precise layout in the face of imprecise fonts.
nscoord emHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
- if (!nsHTMLReflowState::UseComputedHeight()) {
+ if (!nsHTMLReflowState::UseComputedHeight() && fm) {
fm->GetEmHeight(emHeight);
}
#endif
@@ -2312,7 +2316,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
lineHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
- if (!nsHTMLReflowState::UseComputedHeight()) {
+ if (!nsHTMLReflowState::UseComputedHeight() && fm) {
lineHeight = GetNormalLineHeight(fm);
}
#endif
diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp
index 8eabc8ebb26..d73a33f05da 100644
--- a/layout/html/base/src/nsHTMLReflowState.cpp
+++ b/layout/html/base/src/nsHTMLReflowState.cpp
@@ -2290,6 +2290,10 @@ ComputeLineHeight(nsIPresContext* aPresContext,
nsCOMPtr fm;
deviceContext->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
+ if (!fm) {
+ NS_WARNING( "null font metrics for the device context - we have to fix this someday...");
+ }
+
if (unit == eStyleUnit_Factor) {
// For factor units the computed value of the line-height property
// is found by multiplying the factor by the font's actual
@@ -2303,7 +2307,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
// precise layout in the face of imprecise fonts.
nscoord emHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
- if (!nsHTMLReflowState::UseComputedHeight()) {
+ if (!nsHTMLReflowState::UseComputedHeight() && fm) {
fm->GetEmHeight(emHeight);
}
#endif
@@ -2312,7 +2316,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
lineHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
- if (!nsHTMLReflowState::UseComputedHeight()) {
+ if (!nsHTMLReflowState::UseComputedHeight() && fm) {
lineHeight = GetNormalLineHeight(fm);
}
#endif