fix: check for nil last line (#83)

prevent error when focusing playground after closing buffer
master
mohsen 2 years ago committed by GitHub
parent 71b00a3c66
commit ce7e4b7575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -117,7 +117,7 @@ function M.get_end_pos(bufnr)
local bufnr = bufnr or api.nvim_get_current_buf()
local last_row = api.nvim_buf_line_count(bufnr) - 1
local last_line = api.nvim_buf_get_lines(bufnr, last_row, last_row + 1, true)[1]
local last_col = #last_line
local last_col = last_line and #last_line or 0
return last_row, last_col
end

Loading…
Cancel
Save