Check if "cur" is null in patchDisplay()

Not exactly sure if cur could be null at all. But in a use case where a line widget is added above the first line of the document, cur.previousSibling threw an NPE.