ElvUI-TBC / ElvUI

ElvUI for World of Warcraft - The Burning Crusade (2.4.3)
https://discord.gg/UXSc7nt
104 stars 24 forks source link

WIM Error TBC #473

Open michealcell opened 5 years ago

michealcell commented 5 years ago

Using ElvUI 1.48 and WIM 2.4.15

Message: Interface\AddOns\WIM\WIM.lua:2029: bad argument #1 to 'strlower' (string expected, got nil) Time: 07/05/19 11:48:37 Count: 1 Stack: (tail call): ? C: in function strlower' Interface\AddOns\WIM\WIM.lua:2029: in functionWIM_FilterResult' Interface\AddOns\WIM\WIM.lua:1994: in function WIM_FilterResult_Interface' Interface\AddOns\WIM\WIM.lua:545: in functionfilterFunc' Interface\AddOns\ElvUI\modules\chat\chat.lua:795: in function ChatFrame_MessageEventHandler' Interface\AddOns\ElvUI\modules\chat\chat.lua:1411: in functionDisplayChatHistory' Interface\AddOns\ElvUI\modules\chat\chat.lua:1673: in function `Initialize' Interface\AddOns\ElvUI\modules\chat\chat.lua:1774: in function <Interface\AddOns\ElvUI\modules\chat\chat.lua:1773> ...ibraries\CallbackHandler-1.0\CallbackHandler-1.0.lua:155: in function <...ibraries\CallbackHandler-1.0\CallbackHandler-1.0.lua:155>

[string "safecall Dispatcher[1]"]:13: in function ?' ...ibraries\CallbackHandler-1.0\CallbackHandler-1.0.lua:90: in functionFire' Interface\AddOns\ElvUI\core\core.lua:1081: in function InitializeModules' Interface\AddOns\ElvUI\core\core.lua:1241: in functionInitialize' Interface\AddOns\ElvUI\init.lua:145: in function <Interface\AddOns\ElvUI\init.lua:144>

Tremolo4 commented 4 years ago

I've investigated this a bit, and it only happens to me when logging in with ElvUI Chat History turned on AND having gotten at least one whisper message since the history was turned on.

Tremolo4 commented 4 years ago

This patch to WIM fixes the error:

--- a/WIM/WIM.lua
+++ b/WIM/WIM.lua
@@ -539,7 +539,8 @@ function WIM_Incoming(event)
 end

 -- This chunk of code utilized ChatFrame_MessageEventFilter API's in order to suppress whispers to the chat frame.
-function WIM_ChatFrame_MessageEventFilter_WHISPERS(msg)
+function WIM_ChatFrame_MessageEventFilter_WHISPERS(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, event)
+   local msg = arg1
    local filterResult = 0; -- initially, all messages may pass.
    if(arg6 ~= "GM") then
        filterResult = WIM_FilterResult_Interface(arg1, arg2, event == "CHAT_MSG_WHISPER", false, arg11);

I REALLY do not understand why it worked before (without ElvUI). I suspect there's something funky about varargs in wow lua.

The WIM filter function is called from ElvUI code here.

When that function is in turn called from here via varargs (...), arg1, arg2 are accessible in the WIM filter function (even before my patch). I have no idea why! But when called from the history code, here, arg1, arg2 etc. are NOT accessible in the WIM filter function, as I would expect. Then it only works with my patch, where these arguments are properly named.

Enough legacy wow rabbit hole for now 😩