| Index: Source/core/editing/CompositeEditCommand.cpp
|
| diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
|
| index d69188eaf5ddfaad342c3372ef2af9ccdb64ca75..fcd66b30e856803be18cb54771c0cd406b222ee4 100644
|
| --- a/Source/core/editing/CompositeEditCommand.cpp
|
| +++ b/Source/core/editing/CompositeEditCommand.cpp
|
| @@ -1234,15 +1234,17 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
|
| applyStyle(styleInEmptyParagraph.get());
|
|
|
| if (preserveSelection && startIndex != -1) {
|
| - // Fragment creation (using createMarkup) incorrectly uses regular
|
| - // spaces instead of nbsps for some spaces that were rendered (11475), which
|
| - // causes spaces to be collapsed during the move operation. This results
|
| - // in a call to rangeFromLocationAndLength with a location past the end
|
| - // of the document (which will return null).
|
| - RefPtr<Range> start = PlainTextRange(destinationIndex + startIndex).createRangeForSelection(*document().documentElement());
|
| - RefPtr<Range> end = PlainTextRange(destinationIndex + endIndex).createRangeForSelection(*document().documentElement());
|
| - if (start && end)
|
| - setEndingSelection(VisibleSelection(start->startPosition(), end->startPosition(), DOWNSTREAM, originalIsDirectional));
|
| + if (Element* documentElement = document().documentElement()) {
|
| + // Fragment creation (using createMarkup) incorrectly uses regular
|
| + // spaces instead of nbsps for some spaces that were rendered (11475), which
|
| + // causes spaces to be collapsed during the move operation. This results
|
| + // in a call to rangeFromLocationAndLength with a location past the end
|
| + // of the document (which will return null).
|
| + RefPtr<Range> start = PlainTextRange(destinationIndex + startIndex).createRangeForSelection(*documentElement);
|
| + RefPtr<Range> end = PlainTextRange(destinationIndex + endIndex).createRangeForSelection(*documentElement);
|
| + if (start && end)
|
| + setEndingSelection(VisibleSelection(start->startPosition(), end->startPosition(), DOWNSTREAM, originalIsDirectional));
|
| + }
|
| }
|
| }
|
|
|
|
|