fix(loader): don't deactivate when not loaded

This commit is contained in:
Folke Lemaitre 2023-02-10 17:47:25 +01:00
parent e28555950f
commit c83d2aeb27
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 5 additions and 1 deletions

View File

@ -183,6 +183,10 @@ end
---@param plugin LazyPlugin ---@param plugin LazyPlugin
function M.deactivate(plugin) function M.deactivate(plugin)
if not plugin._.loaded then
return
end
local main = M.get_main(plugin) local main = M.get_main(plugin)
if main then if main then
@ -195,7 +199,7 @@ function M.deactivate(plugin)
end end
-- execute deactivate when needed -- execute deactivate when needed
if plugin._.loaded and plugin.deactivate then if plugin.deactivate then
Util.try(function() Util.try(function()
plugin.deactivate(plugin) plugin.deactivate(plugin)
end, "Failed to deactivate plugin " .. plugin.name) end, "Failed to deactivate plugin " .. plugin.name)