fixed getNextLine

Fixed getNextLine. Previously, a line break at position 0 would cause the whole buffer to be returned.