don't dereference aContext without checking for null

This commit is contained in:
alecf%netscape.com 1999-05-07 03:08:02 +00:00
parent faa282cbe5
commit b8c3aa89b4
3 changed files with 9 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);