Index: Source/core/editing/ReplaceSelectionCommand.cpp |
diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp |
index 8b8f99f1294b1b0e365e04c3fd0b0dbcf2b34957..fc6340fce51e5be5bca1dec3614f1758279af162 100644 |
--- a/Source/core/editing/ReplaceSelectionCommand.cpp |
+++ b/Source/core/editing/ReplaceSelectionCommand.cpp |
@@ -1447,8 +1447,10 @@ Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<HTMLElement> prpList |
} else |
ASSERT_NOT_REACHED(); |
} |
- if (isStart || isMiddle) |
- lastNode = lastNode->previousSibling(); |
+ if (isStart || isMiddle) { |
+ if (Node* node = lastNode->previousSibling()) |
+ return node; |
+ } |
return lastNode; |
} |