From 22c6f54aa2deab6af20274fe53e883517e778c81 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 18 May 2017 14:50:05 -0700 Subject: [PATCH] Bug 1357716 - stylo: Don't return uninitialized pointers from GetCSSStyleRules. r=xidorn MozReview-Commit-ID: JPj6d27PALc --HG-- extra : rebase_source : 7565f4aeee5a6bf2b134d0b05981cc18038247db --- layout/inspector/inDOMUtils.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index adab3782d4bc..1b463bde9fb4 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -299,11 +299,15 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement, // Find matching rules in the table. for (size_t j = 0; j < rawRuleCount; j++) { const RawServoStyleRule* rawRule = rawRuleList.ElementAt(j); - ServoStyleRule* rule; - rawRulesToRules.Get(rawRule, &rule); - MOZ_ASSERT(rule, "We should always be able to map a raw rule to a rule."); - RefPtr ruleObj(rule); - rules->AppendElement(ruleObj, false); + ServoStyleRule* rule = nullptr; + if (rawRulesToRules.Get(rawRule, &rule)) { + MOZ_ASSERT(rule, "rule should not be null"); + RefPtr ruleObj(rule); + rules->AppendElement(ruleObj, false); + } else { + // FIXME (bug 1359217): Need a reliable way to map raw rules to rules. + NS_WARNING("stylo: Could not map raw rule to a rule."); + } } }