mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
fix: check if bufdata.last_win != nil (#356)
When opening nvim in diffview (`nvim -c DiffviewOpen`) and then toggeling aerial, aerial errors when trying to call `vim.api.nvim_win_is_valid(bufdata.last_win)` as bufdata.last_win == nil. This change adds a check and returns in case of a nil value. Co-authored-by: Linus Boehm <linusboehm@gmail.com>
This commit is contained in:
parent
51a07949ab
commit
24ebacab58
1 changed files with 3 additions and 0 deletions
|
@ -538,6 +538,9 @@ M.center_symbol_in_view = function(buffer)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local bufdata = data.get_or_create(bufnr)
|
local bufdata = data.get_or_create(bufnr)
|
||||||
|
if not bufdata.last_win then
|
||||||
|
return
|
||||||
|
end
|
||||||
if vim.api.nvim_buf_is_valid(aer_bufnr) and vim.api.nvim_win_is_valid(bufdata.last_win) then
|
if vim.api.nvim_buf_is_valid(aer_bufnr) and vim.api.nvim_win_is_valid(bufdata.last_win) then
|
||||||
local last_position = bufdata.positions[bufdata.last_win]
|
local last_position = bufdata.positions[bufdata.last_win]
|
||||||
if last_position then
|
if last_position then
|
||||||
|
|
Loading…
Reference in a new issue