DBM - Deadly Boss Mods (DBM-Core)

DBM - Deadly Boss Mods (DBM-Core)

530M Downloads

AddMessage (a nil value), Referencing a "nil" frame

Defmaster opened this issue ยท 1 comments

commented

Describe the bug
Normal behavior, got lua error.
What happens: I should get a chat message for certain warnings. This does not happen but i get a lua error instead. There are 2 things happening here.

  1. In Line 10331 of dbm-core.lua
    self.mod:AddMsg(colorCode.."["..L.MOVE_SPECIAL_WARNING_TEXT.."] "..text.."|r", nil)
    Which leads to line 7457
    local frame = _G[tostring(self.Options.ChatFrame)]
    'self' seems to not reference DBM here hence "self.Options.ChatFrame" will be 'nil'

  2. Because it is 'nil' this -> tostring(self.Options.ChatFrame) will reference _G["nil"] so a string nil not a 'nil' value.
    Because of some other addon i guess i have a frame which reference to that _G["nil"].
    frame = frame and frame:IsShown() and frame or DEFAULT_CHAT_FRAME
    Will be referencing this "nil" frame (and :IsShown() is true) but is does not have a "AddMessage" method.
    So instead of falling back to "DEFAULT_CHAT_FRAME" it's trying to call method on a wrong frame.

So things to do would be: check why "self.mod:AddMsg" lead to a nil value.
And make a robust nil check.

For now i fixed it for myself this way:
local frame = self.Options.ChatFrame and _G[tostring(self.Options.ChatFrame)] or DEFAULT_CHAT_FRAME
But i don't want to change it everytime i update DBM.

Do you have an error log of what happened?
3x DBM-Core\DBM-Core-9.0.21-23-g722a0bd.lua:7461: attempt to call method 'AddMessage' (a nil value)
[string "@DBM-Core\DBM-Core-9.0.21-23-g722a0bd.lua"]:7461: in function AddMsg' [string "@DBM-Core\DBM-Core-9.0.21-23-g722a0bd.lua"]:10332: in function Show'
[string "@DBM-Challenges\Shadowlands\Torghast.lua"]:109: in function `handler'
[string "@DBM-Core\DBM-Core-9.0.21-23-g722a0bd.lua"]:892: in function <DBM-Core\DBM-Core.lua:879>
[string "=(tail call)"]: ?
[string "@DBM-Core\DBM-Core-9.0.21-23-g722a0bd.lua"]:892: in function <DBM-Core\DBM-Core.lua:879>

To Reproduce
Make youself a _G["nil"] frame ;)

Did you try having DeadlyBossMods as the only enabled addon and everything else (especially something like ElvUI) disabled?
No.

Which version of DeadlyBossMods are you using?
Latest alpha

Was it working in a previous version? If yes, which was the last good one?
Yes, but doesnt now which one. But seem to be a problem with another addon coupled with "bad" nil check.

commented

I see both problems, thanks for such a thorough writeup. This will be fixed in release going out soon. Closing issue.