Topic [RESOLVED] I thought I'd squashed this bug, but no...
Luxxoria
Vek'nilash
Luxxoria
85 Blood Elf Mage
2470
Edited by Luxxoria on 01/05/12 09:53 (BST)
EDIT: It would appear that there is a problem with the Curse website. The new version of EPA (which this post refers to) doesn't appear to be on the addon's page, despite the fact it has been approved by Curse staff. However, this bug still exists, and I would still like it squashed.

I recently updated my EasyPortalAdvert addon. Within hours of it going live on Curse, a ticket is posted detailing a bug I thought I had squashed in the previous version.

The person who reported the bug pasted this error message.


Date: 2012-04-30 01:59:21
ID: 1
Error occured in:
Global Count: 37
Message: ...terface\AddOns\EasyPortalAdvert\EasyPortalAdvert.lua line 8: attempt to index global 'EPAConfig' (a nil value)
Debug: (tail call): ? [C]: ? ...terface\AddOns\EasyPortalAdvert\EasyPortalAdvert.lua:8: ...terface\AddOns\EasyPortalAdvert\EasyPortalAdvert.lua:6


I have no idea how this is happening, but it would appear this bug rears its ugly head with each new version of EPA.

I want to crush this thing once and for all, and any help is appreciated.

Here is EasyPortalAdvert.lua as it stands right now: http://pastebin.com/dApxcU3A

I'm probably making a really stupid mistake here, but I can't see it.

If someone could look at the code and tell me where I've went wrong, that would be great.
Knarko
Grim Batol
Knarko
90 Human Priest
16715
I'm not good at lua. I know almost nothing. But what happens if you leave out rows 8 to 10?
Prr
Eredar
Prr
90 Tauren Druid
12310
Edited by Prr on 30/04/12 13:42 (BST)
As it seems you are calling an element of EPAConfig, which can be a nil value here. So I think the following change to lines 8 to 10 should fix it:

if EPAConfig and (EPAConfig.PerPerson == nil or EPAConfig.PerPerson == "") then
EPAConfig.PerPerson = 'NO'
end


It is a nil value especially when someone did not use your addon before. Assuming that EPAConfig is stored in your saved variables. ;-)

Another solution would be to swap this if-clause with the following one. Since after the following if-clause EPAConfig is definitely initialised.
Luxxoria
Vek'nilash
Luxxoria
85 Blood Elf Mage
2470
I changed the start of EasyPortalAdvert.lua to read


function portalservice_OnLoad()

if EPAConfig == nil then
EPAConfig = {
["City"] = '5g',
["Dalaran"] = '10g',
["Shattrath"] = '5g',
["Other"] = 'Free',
["TradeChannel"] = '2',
["TolBarad"] = '10g',
["GeneralChannel"] = '1',
["DoReturns"] = 'NO',
["ReturnsMsg"] = 'I do not offer return journeys',
["ReturnValue"] = '50',
["ReadySound"] = 'true',
["SoundID"] = '1',
["ROPAlert"] = '5',
["ROTAlert"] = '5',
["BeenAlerted"] = 'false',
["TeleAlert"] = 'false',
["GoToYou"] = 'NO',
["GTYMsg"] = '.',
["PowderAlert"] = '5',
["ArcaneAlert"] = 'false',
["Keyword"] = '!portal',
["PerPerson"] = 'NO'
}
end

-- REST OF CODE


Then I deleted my own Saved Variables and logged into my Mage. No errors. So it would appear that I have managed to crush this bug.

Thanks for your help, everyone!

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Click here to view the Forums Code of Conduct.

Report Post # written by
Reason
Explain (256 characters max)

Reported!

[Close]