Index: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
index 574420ae0a473fee3ffe37c92549827fa4972b0f..a0a7e3dd9a427bcb3fd356f2c86ff50d667260ac 100644 |
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
@@ -1341,8 +1341,13 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap |
destinationIndex = TextIterator::rangeLength(Position::firstPositionInNode(document().documentElement()), destination.toParentAnchoredPosition(), true); |
- setEndingSelection(VisibleSelection(destination, originalIsDirectional)); |
- DCHECK(!endingSelection().isNone()); |
+ VisibleSelection destinationSelection(destination, originalIsDirectional); |
+ if (endingSelection().isNone()) { |
+ // We abort executing command since |destination| becomes invisible. |
+ editingState->abort(); |
+ return; |
+ } |
+ setEndingSelection(destinationSelection); |
ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MovingParagraph; |
if (shouldPreserveStyle == DoNotPreserveStyle) |
options |= ReplaceSelectionCommand::MatchStyle; |