Skip to content

Commit 1724421

Browse files
DenzellceWolf
authored andcommitted
fix(notification): nvim_win_is_valid does not accepts nil
if the window has not yet been opened, the winID is not set. Passing a nil value to nvim_win_is_valid returns an error instead of false
1 parent d4eb763 commit 1724421

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lua/cmake-tools/notification.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Notification:notify(msg, level, opts)
8888

8989
-- We have to check for a valid window here as it seems notify invokes the on_close callback async.
9090
-- Hence checking for self.closed would not work as it gets set too late
91-
if vim.api.nvim_win_is_valid(self.win) and self.width then
91+
if self.win and vim.api.nvim_win_is_valid(self.win) and self.width then
9292
-- update the notification width when the message was updated
9393
local timeDigits = 8
9494
local headlineLength = (self.opts.icon and (#self.opts.icon + 1) or 0)

0 commit comments

Comments
 (0)