Index: third_party/WebKit/Source/core/editing/spellcheck/HotModeSpellCheckRequester.cpp |
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/HotModeSpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/HotModeSpellCheckRequester.cpp |
index 3b106ceba3650c104d0a449ab02ff6dc54518adb..845cd1fdd96082b558c0a7634a6b1b7acae63521 100644 |
--- a/third_party/WebKit/Source/core/editing/spellcheck/HotModeSpellCheckRequester.cpp |
+++ b/third_party/WebKit/Source/core/editing/spellcheck/HotModeSpellCheckRequester.cpp |
@@ -73,11 +73,13 @@ EphemeralRange calculateHotModeCheckingRange(const Element& editable, |
.build(); |
BackwardsCharacterIterator backwardIterator(fullRange.startPosition(), |
position, behavior); |
- backwardIterator.advance(kHotModeChunkSize / 2); |
+ if (!backwardIterator.atEnd()) |
+ backwardIterator.advance(kHotModeChunkSize / 2); |
const Position& chunkStart = backwardIterator.endPosition(); |
CharacterIterator forwardIterator(position, fullRange.endPosition(), |
behavior); |
- forwardIterator.advance(kHotModeChunkSize / 2); |
+ if (!forwardIterator.atEnd()) |
+ forwardIterator.advance(kHotModeChunkSize / 2); |
const Position& chunkEnd = forwardIterator.endPosition(); |
return expandRangeToSentenceBoundary(EphemeralRange(chunkStart, chunkEnd)); |
} |