     if intactRanges.length == 0
       @lines[0].innerHTML = ''
     else if currentLine = @lines[0].firstChild
+      unless currentLine?
+        console.warn "Unexpected undefined first line in clearing dirty ranges"
+        return
+
       domPosition = 0
       for intactRange in intactRanges
         while intactRange.domStart > domPosition

    next = lineElement.nextSibling
    @lines[0].removeChild(lineElement)
    next


  fillDirtyRanges: (intactRanges, renderFrom, renderTo) ->
    i = 0

          domPosition++

        for i in [intactRange.start..intactRange.end]
          unless currentLine?
            console.warn "Unexpected undefined line when clearing dirty range #{intactRange.start}..#{intactRange.end}"
            return
          currentLine = currentLine.nextSibling
          domPosition++

