diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index 9f47835bf80..806a524e7c6 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -534,7 +534,9 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext, // XXX Stop-gap fix to prevent ua.css rules from being applied // to XML elements nsIHTMLContent *htmlContent; - nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); + nsresult rv = NS_ERROR_FAILURE; + if (aContent) + rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); PRInt32 ruleCount = 0; if (NS_SUCCEEDED(rv)) { ruleCount += RulesMatching(mBackstopSheets, aPresContext, medium, aContent, aParentContext, rules); diff --git a/mozilla/layout/base/src/nsStyleSet.cpp b/mozilla/layout/base/src/nsStyleSet.cpp index 9f47835bf80..806a524e7c6 100644 --- a/mozilla/layout/base/src/nsStyleSet.cpp +++ b/mozilla/layout/base/src/nsStyleSet.cpp @@ -534,7 +534,9 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext, // XXX Stop-gap fix to prevent ua.css rules from being applied // to XML elements nsIHTMLContent *htmlContent; - nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); + nsresult rv = NS_ERROR_FAILURE; + if (aContent) + rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); PRInt32 ruleCount = 0; if (NS_SUCCEEDED(rv)) { ruleCount += RulesMatching(mBackstopSheets, aPresContext, medium, aContent, aParentContext, rules); diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index 9f47835bf80..806a524e7c6 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -534,7 +534,9 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext, // XXX Stop-gap fix to prevent ua.css rules from being applied // to XML elements nsIHTMLContent *htmlContent; - nsresult rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); + nsresult rv = NS_ERROR_FAILURE; + if (aContent) + rv = aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); PRInt32 ruleCount = 0; if (NS_SUCCEEDED(rv)) { ruleCount += RulesMatching(mBackstopSheets, aPresContext, medium, aContent, aParentContext, rules);