From c83d2aeb27fce9cf9f14e779e77a85c63fc3d2c9 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 10 Feb 2023 17:47:25 +0100 Subject: [PATCH] fix(loader): don't deactivate when not loaded --- lua/lazy/core/loader.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 6c369c6..e826654 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -183,6 +183,10 @@ end ---@param plugin LazyPlugin function M.deactivate(plugin) + if not plugin._.loaded then + return + end + local main = M.get_main(plugin) if main then @@ -195,7 +199,7 @@ function M.deactivate(plugin) end -- execute deactivate when needed - if plugin._.loaded and plugin.deactivate then + if plugin.deactivate then Util.try(function() plugin.deactivate(plugin) end, "Failed to deactivate plugin " .. plugin.name)