1

The addon I'm making searchs for certain words within chats and then sends them to a specified chatframe it works but randomly it causes an error and crashes the game

This application has encountered a critical error:
ERROR #132 (0x85100084) Fatal Exception
Program:    C:\WoW\Wow.exe
Exception:  0xC0000005 (ACCESS_VIOLATION) at 0023:00416DB0

The instruction at "0x00416DB0" referenced memory at "0x1F97FFFE".
The memory could not be "read".


I opened cheatengine to browse the region after it crashed to see what was there

1F97FFFE: http://i.imgur.com/D7XKi2D.jpg
00416DB0: http://i.imgur.com/duTM315.jpg

and the addon code:

--Event CHAT_MSG_CHANNEL
if event == "CHAT_MSG_CHANNEL" then
    if TriggerEnabled then
        local arg1 = string.lower(arg1)
        local found, dump = false, false

        for k,v in pairs(lsus.Triggers) do
            if not found then
                for k,v in pairs(lsus.NegTriggers) do
                    if (string.find(arg1, v)) then
                        dump = true
                    end
                end

                if (string.find(arg1, v)) and not dump then
                    local output = " [\124Hplayer:" .. arg2 .. ":1:WHISPER\124h" .. arg2 .. "\124h\124r]: " .. arg1:gsub(v, "\124c0000FF00\124h" .. string.upper(v) .. "\124h\124r")
                    print(output, 0.41, 0.80, 0.94)
                    found = true
                end
            end
        end
    end
end


--print function
function print(msg, r, g, b)
    if not r then
        ChatFrame1:AddMessage(msg)
    else
        ChatFrame1:AddMessage(msg, r, g, b)
    end
end

can anyone help me with why this is crashing the game?

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • 3
    https://eu.battle.net/support/en/article/error-132 Try reverting to DX9. Probably not caused by the addon. – Blenderer Mar 05 '13 at 21:08

1 Answers1

0

Probably it is not your case, but try using string.find(arg1, v, 1, true) instead of string.find(arg1, v) to avoid unexpected behavior due to magic chars in pattern.

-- Example:
local str = 'string.find hangs on this string'
string.find(str, '.*.*.*.*.*.*.*.*.*.*.*#')
Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64