From 17e28b6ed8fba6c8ebb054668837ac190b33dacb Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 25 Jun 2020 10:17:23 +0200 Subject: [PATCH] autovendor: abort when merchant window is closed --- modules/autovendor.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/autovendor.lua b/modules/autovendor.lua index 3f6847e8..1e20c4eb 100644 --- a/modules/autovendor.lua +++ b/modules/autovendor.lua @@ -70,6 +70,9 @@ pfUI:RegisterModule("autovendor", "vanilla:tbc", function () this.count = this.count + 1 end + -- abort if the merchant window disappeared + if not this.merchant then return end + -- clear cursor and sell the item ClearCursor() UseContainerItem(bag, slot) @@ -82,11 +85,16 @@ pfUI:RegisterModule("autovendor", "vanilla:tbc", function () end) autovendor:RegisterEvent("MERCHANT_SHOW") + autovendor:RegisterEvent("MERCHANT_CLOSED") autovendor:RegisterEvent("MERCHANT_UPDATE") autovendor:SetScript("OnEvent", function() autovendor.button:Update() - if event == "MERCHANT_SHOW" then + if event == "MERCHANT_CLOSED" then + autovendor.merchant = nil + autovendor:Hide() + elseif event == "MERCHANT_SHOW" then + autovendor.merchant = true if C["global"]["autorepair"] == "1" then RepairItems() end