       return new Range(@getFirstPosition(), @getFirstPosition())
 
     if startRow > lastRow
-      return new Range(@getLastPosition(), @getLastPosition())
+      return new Range(@getEndPosition(), @getEndPosition())
 
     startRow = Math.max(0, startRow)
     endRow = Math.min(lastRow, endRow)

    new Point(0, 0)

  # Public: Returns a {Point} representing the maximal position in the buffer.
  getLastPosition: ->
    lastRow = @getLastRow()
    new Point(lastRow, @lineLengthForRow(lastRow))

  # Public: Returns a {Range} associated with the text of the entire buffer,
  # from its first position to its last position.
  getRange: ->
    new Range(@getFirstPosition(), @getLastPosition())

  # Public: Returns the range for the given row
  #

    if row < 0
      @getFirstPosition()
    else if row > @getLastRow()
      @getEndPosition()
    else
      column = Math.min(Math.max(column, 0), @lineLengthForRow(row))
      if column is position.column
