Index: Source/core/dom/TreeScope.cpp |
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp |
index 370397441482bf28bab149239580bf38e6c8bea7..1ec312f6a338e3a89c26d8acf020f7a08d812c11 100644 |
--- a/Source/core/dom/TreeScope.cpp |
+++ b/Source/core/dom/TreeScope.cpp |
@@ -277,7 +277,8 @@ HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV |
if (!m_labelsByForAttribute) { |
// Populate the map on first access. |
m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap); |
- for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(*element)) { |
+ ASSERT(rootNode()); |
+ for (Element* element = ElementTraversal::firstWithin(*rootNode()); element; element = ElementTraversal::next(*element)) { |
if (isHTMLLabelElement(element)) { |
HTMLLabelElement* label = toHTMLLabelElement(element); |
const AtomicString& forValue = label->fastGetAttribute(forAttr); |
@@ -311,7 +312,8 @@ Element* TreeScope::findAnchor(const String& name) |
return 0; |
if (Element* element = getElementById(name)) |
return element; |
- for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(*element)) { |
+ ASSERT(rootNode()); |
+ for (Element* element = ElementTraversal::firstWithin(*rootNode()); element; element = ElementTraversal::next(*element)) { |
if (isHTMLAnchorElement(element)) { |
HTMLAnchorElement* anchor = toHTMLAnchorElement(element); |
if (rootNode()->document().inQuirksMode()) { |
@@ -485,7 +487,8 @@ Element* TreeScope::getElementByAccessKey(const String& key) const |
return 0; |
Element* result = 0; |
Node* root = rootNode(); |
- for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(*element, root)) { |
+ ASSERT(root); |
+ for (Element* element = ElementTraversal::firstWithin(*root); element; element = ElementTraversal::next(*element, root)) { |
if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key)) |
result = element; |
for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { |