Skip to content

Commit

Permalink
fix(loader): don't deactivate when not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Feb 10, 2023
1 parent e285559 commit c83d2ae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lazy/core/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit c83d2ae

Please sign in to comment.