Index: Source/core/editing/ApplyBlockElementCommand.cpp |
diff --git a/Source/core/editing/ApplyBlockElementCommand.cpp b/Source/core/editing/ApplyBlockElementCommand.cpp |
index 5ecf67a627649d9769d1236f31b5f777fb76fb77..8467d47eb5034aceaf460169541d880aab429945 100644 |
--- a/Source/core/editing/ApplyBlockElementCommand.cpp |
+++ b/Source/core/editing/ApplyBlockElementCommand.cpp |
@@ -73,8 +73,12 @@ void ApplyBlockElementCommand::doApply() |
// FIXME: We paint the gap before some paragraphs that are indented with left |
// margin/padding, but not others. We should make the gap painting more consistent and |
// then use a left margin/padding rule here. |
- if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) |
- setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(CannotCrossEditingBoundary), endingSelection().isDirectional())); |
+ if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) { |
+ VisibleSelection newSelection(visibleStart, visibleEnd.previous(CannotCrossEditingBoundary), endingSelection().isDirectional()); |
+ if (newSelection.isNone()) |
+ return; |
+ setEndingSelection(newSelection); |
+ } |
VisibleSelection selection = selectionForParagraphIteration(endingSelection()); |
VisiblePosition startOfSelection = selection.visibleStart(); |