From 8ef3a1e0393b632c1ccda93a601c6f3eacb42f3e Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 2 May 2024 21:04:26 +0200 Subject: return early if no file is opened MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-By: Matěj Cepl Tested-By: Alin Mr --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 8b8a8c6..c534eba 100644 --- a/init.lua +++ b/init.lua @@ -109,6 +109,7 @@ local function delete_lock_file(lfile_path) end vis.events.subscribe(vis.events.FILE_OPEN, function(file) + if not file.path then return end local lfile_path = lock_file_path(file.path) if not create_lock_file(lfile_path) and not confirm(lfile_path) then os.exit(1) @@ -116,6 +117,7 @@ vis.events.subscribe(vis.events.FILE_OPEN, function(file) end) vis.events.subscribe(vis.events.FILE_CLOSE, function(file) + if not file.path then return end local lfile_path = lock_file_path(file.path) if created_locks[lfile_path] then delete_lock_file(lfile_path) -- cgit v1.2.3