Index: Source/core/editing/DeleteSelectionCommand.cpp |
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp |
index 7059c7dd7972d15226e0c7a86700c9fb3cb44e22..fd7a7e3bf35195d17689b6a158d1517320667601 100644 |
--- a/Source/core/editing/DeleteSelectionCommand.cpp |
+++ b/Source/core/editing/DeleteSelectionCommand.cpp |
@@ -375,10 +375,16 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeConte |
return; |
} |
- if (node == m_startBlock && !isEndOfBlock(VisiblePosition(firstPositionInNode(m_startBlock.get())).previous())) |
- m_needPlaceholder = true; |
- else if (node == m_endBlock && !isStartOfBlock(VisiblePosition(lastPositionInNode(m_startBlock.get())).next())) |
- m_needPlaceholder = true; |
+ if (node == m_startBlock) { |
+ VisiblePosition previous = VisiblePosition(firstPositionInNode(m_startBlock.get())).previous(); |
+ if (previous.isNotNull() && !isEndOfBlock(previous)) |
+ m_needPlaceholder = true; |
+ } |
+ if (node == m_endBlock) { |
+ VisiblePosition next = VisiblePosition(lastPositionInNode(m_endBlock.get())).next(); |
+ if (next.isNotNull() && !isStartOfBlock(next)) |
+ m_needPlaceholder = true; |
+ } |
// FIXME: Update the endpoints of the range being deleted. |
updatePositionForNodeRemoval(m_endingPosition, *node); |