Null dereference loading Blink layout test editing/execCommand/crash-replacing-list...
[WebKit-https.git] / Source / WebCore / editing / ReplaceSelectionCommand.cpp
index 6f4a8e1..670f278 100644 (file)
@@ -1464,7 +1464,7 @@ Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<HTMLElement> prpList
         } else
             ASSERT_NOT_REACHED();
     }
-    if (isStart || isMiddle)
+    if ((isStart || isMiddle) && lastNode->previousSibling())
         lastNode = lastNode->previousSibling();
     return lastNode;
 }