LUA Error When Mailbox Is Opened...
LUA Error When Mailbox Is Opened...
Hi,
I am getting the following error when I have a CensusPlus scan going and then I open the mailbox...
Addons\CensusPlus\CensusPlus.lua line 310: bad argument #1 to 'strmatch' (string expected, got nil)
Any idea on this one?
Thanks,
BJR
I am getting the following error when I have a CensusPlus scan going and then I open the mailbox...
Addons\CensusPlus\CensusPlus.lua line 310: bad argument #1 to 'strmatch' (string expected, got nil)
Any idea on this one?
Thanks,
BJR
After taking a quick glance at the code, it looks like a null (empty) chat message was sent by something, which CensusPlus isn't expecting (hence, the error). I don't get any errors when opening the mailbox, so what's causing it is likely an AddOn you have loaded that works with the mailbox in some manner (and, for some reason, is sending an empty chat message).
Does the census still run / complete after the error pops up? If so, then you should be able to safely ignore the error for now.
As for a fix, I am not sure if null chat messages are considered "valid", but CP should probably ignore them in any case. Since I don't know if it is more appropriate to immediately pass the null message up the chain or to go through the remainder of the code in the function for any state-change triggers, I'll just do a....
/rolliesignal

Does the census still run / complete after the error pops up? If so, then you should be able to safely ignore the error for now.
As for a fix, I am not sure if null chat messages are considered "valid", but CP should probably ignore them in any case. Since I don't know if it is more appropriate to immediately pass the null message up the chain or to go through the remainder of the code in the function for any state-change triggers, I'll just do a....
/rolliesignal

Thanks...
Heya,
Thanks for the info..I have a few addons that are mail related...so that could be the cause.
As to the scan, it does seem to finish the scan, the other problem I noticed though is that once this error comes up, the chat frame goes dead. Once I get the error, I am unable to see emotes, NPC dialog, chat channel posts (i.e. General, Trade, etc...) and anything printed from addons.
BJR
Thanks for the info..I have a few addons that are mail related...so that could be the cause.
As to the scan, it does seem to finish the scan, the other problem I noticed though is that once this error comes up, the chat frame goes dead. Once I get the error, I am unable to see emotes, NPC dialog, chat channel posts (i.e. General, Trade, etc...) and anything printed from addons.
BJR
Hmm. I was hoping that wouldn't happen, but it unfortunately makes sense.
If you don't want to live without whichever mail-related addon is actually causing this, and Rollie doesn't pop by soon with another suggestion, I can give you a couple of lines to temporarily insert into the censusplus lua code that should bypass the error, anyway.
I don't know of a way to "reset" the code for just the chat frame, but if you reload the UI (/console reloadui), that will reset everything including the chat. Of course, that takes some time, depending on the number of add-ons you have, and it will throw another error the next time the same add-on sends another empty chat message.
If you don't want to live without whichever mail-related addon is actually causing this, and Rollie doesn't pop by soon with another suggestion, I can give you a couple of lines to temporarily insert into the censusplus lua code that should bypass the error, anyway.
I don't know of a way to "reset" the code for just the chat frame, but if you reload the UI (/console reloadui), that will reset everything including the chat. Of course, that takes some time, depending on the number of add-ons you have, and it will throw another error the next time the same add-on sends another empty chat message.
I was taking a closer look at the CensusPlus function, and noticed a simple one line edit that would solve the problem. To test, I whipped up something to generate null chat messages, but I was unable to trigger the error. One of the other addons I have loaded is probably eating the null messages before they get to CP.
Anyway, I made the edit to CP, and scans are still working for me, so it should be safe for you to try, if you are willing.
Locate the file "CensusPlus.lua" located in the "Interface/AddOns/CensusPlus" directory, located within your WoW directory, and open it with a text editor.
If you are using Windows, then Notepad is not a good text editor! If you don't have anything else, then WordPad should work without mangling the file.
Anyway, in CensusPlus.lua, go to line 296. If your editor doesn't have a "go to line number" feature, then search for "-- Chat msg hook" (without the quotes), then scroll down eight lines. Here's what that part of the file looks like, with the relevant line marked with asterisks:
Edit or replace the highlighted line so that it looks like the following:
Save the file (if offered a choice to convert it, keep it as plain text), and fire up WoW to see if the error has stopped. If you still get an error, or get another error, let us know.
Anyway, I made the edit to CP, and scans are still working for me, so it should be safe for you to try, if you are willing.
Locate the file "CensusPlus.lua" located in the "Interface/AddOns/CensusPlus" directory, located within your WoW directory, and open it with a text editor.
If you are using Windows, then Notepad is not a good text editor! If you don't have anything else, then WordPad should work without mangling the file.
Anyway, in CensusPlus.lua, go to line 296. If your editor doesn't have a "go to line number" feature, then search for "-- Chat msg hook" (without the quotes), then scroll down eight lines. Here's what that part of the file looks like, with the relevant line marked with asterisks:
Code: Select all
----------------------------------------------------------------------------------
--
-- Chat msg hook
--
---------------------------------------------------------------------------------
local function CP_HookAddMessage(frame)
local AddMessage = frame.AddMessage;
-- Create a closure to cleanly hook the AddMessage routine.
frame.AddMessage =
function (this, msg, r, g, b, id)
**** if( g_TrackUnhandled or g_IsCensusPlusInProgress ) then ****
local s, e;
local results = { };
local whoMsg = false;
--CensusPlus_Msg2( "Something : " .. msg );
Code: Select all
if( (g_TrackUnhandled or g_IsCensusPlusInProgress) and msg ) then
Thanks for the info; I will give it a try.
A few new things happened while I was playing. The error was always on my bank alt, so I was never killing mobs. While playing my main, I noticed that I also get the error when any type of loot comes up. For example, I got the error when I looted a mob and I also got it when I opened the NPC vendor window.
I am not sure if this help determine anything new about the error or not.
Anyways, thanks for your help & I will see if this change works for my situation.
Thanks,
BJR
A few new things happened while I was playing. The error was always on my bank alt, so I was never killing mobs. While playing my main, I noticed that I also get the error when any type of loot comes up. For example, I got the error when I looted a mob and I also got it when I opened the NPC vendor window.
I am not sure if this help determine anything new about the error or not.
Anyways, thanks for your help & I will see if this change works for my situation.
Thanks,
BJR
I'm glad you found the (probable) culprit. With the additional information, it sounds like the addon is sending an empty chat message whenever it's triggered by a new window (frame) opening.
I'd say it's likely a bug with Cashier. My guess without looking at it is that it is looking for money loot events as well as vendor purchases / sales (and similar money from the mail), but is still sending a (blank) message even if your gold amount didn't change (i.e., it didn't set up the gain / loss message, but still tried to send the non-existent message).
I'd say it's likely a bug with Cashier. My guess without looking at it is that it is looking for money loot events as well as vendor purchases / sales (and similar money from the mail), but is still sending a (blank) message even if your gold amount didn't change (i.e., it didn't set up the gain / loss message, but still tried to send the non-existent message).
FYI, I found what was masking the null messages for me, and verified that I get the same error as you with the "stock" CensusPlus, and that my change fixes it so the error doesn't appear any more.
In some of my own code, originally written in the 2.1 era, I notice I made sure I didn't ever send null messages to the chat frame, but I don't remember whether that was to avoid errors at the time, or whether I was just programming defensively. In any case, it appears that the current default chat handler doesn't care.
In some of my own code, originally written in the 2.1 era, I notice I made sure I didn't ever send null messages to the chat frame, but I don't remember whether that was to avoid errors at the time, or whether I was just programming defensively. In any case, it appears that the current default chat handler doesn't care.