Index: Source/core/editing/iterators/TextIterator.cpp |
diff --git a/Source/core/editing/iterators/TextIterator.cpp b/Source/core/editing/iterators/TextIterator.cpp |
index b1c57bc7f7e2f8453306112f343dcf4b131232b2..0c9aa7edc6b851be5426c5e81f8d33c49afe9bb8 100644 |
--- a/Source/core/editing/iterators/TextIterator.cpp |
+++ b/Source/core/editing/iterators/TextIterator.cpp |
@@ -368,6 +368,11 @@ void TextIteratorAlgorithm<Strategy>::advance() |
if (!next && !parentNode && m_shadowDepth > 0) { |
// 4. Reached the top of a shadow root. If it's created by author, then try to visit the next |
// sibling shadow root, if any. |
+ if (!m_node->isShadowRoot()) { |
+ ASSERT_NOT_REACHED(); |
+ m_shouldStop = true; |
+ return; |
+ } |
ShadowRoot* shadowRoot = toShadowRoot(m_node); |
if (shadowRoot->type() == ShadowRootType::OpenByDefault || shadowRoot->type() == ShadowRootType::Open) { |
ShadowRoot* nextShadowRoot = shadowRoot->olderShadowRoot(); |