Attempt to index global 'FramesDB' (a nil value)
kaytotes opened this issue · 2 comments
I've been having in issue with Wasabi db7f114 for a short while but trying to finally tackle it now. In my addon Improved Blizzard UI I use Wasabi for the configuration.
I've been having an issue that only affects new users or when I add a new configuration option. Essentially due to them not having the saved variables any checks towards them are attempting to access a nil global and failing, doing a /reload (after the variables have been created) resolves the issue going forwards. At least until a new option is added.
I'm unsure if this is a bug or an implementation issue / misunderstanding on my part. How best should I be handling ensuring this can't be nil and deferring until they're set?
Here is an error message I'm getting however plenty are generated on first load.
3x ...ddOns\ImprovedBlizzardUI\modules\frames\killfeed.lua:170: attempt to index global 'FramesDB' (a nil value)
...ddOns\ImprovedBlizzardUI\modules\frames\killfeed.lua:170: in function <...ddOns\ImprovedBlizzardUI\modules\frames\killfeed.lua:167>
Locals:
event = "ADDON_LOADED"
(*temporary) = "attempt to index global 'FramesDB' (a nil value)"
KillFeed_Update = <function> defined @ImprovedBlizzardUI\modules\frames\killfeed.lua:55
This directly coincides with this line of code which makes sense to me because obviously it's before any addon loaded events etc. However in the same file during these lines I am waiting for addon loaded and yet this errors too.
Could you possibly advise on best practices for this situation if at all possible?
Obviously, SV are not loaded until the addon is completely loaded (ADDON_LOADED
event), so the DB will never be populated before that point. That is your error.
However, there's an error on Wasabi's end too. Since Wasabi doesn't necessarily know the name of the addon using it, all SV are loaded in during PLAYER_LOGIN
as it fires when ALL addons are loaded.
This is something I obviously need to fix (easy when Wasabi is embedded, not as easy when not, I'll have to investigate).
As a temporary fix you can trigger the event handler of the panel using something like this:
if(event == 'ADDON_LOADED' and ... == addOnName) then
MyPanel:GetScript('OnEvent')(MyPanel, 'PLAYER_LOGIN')
...
end
I'll try and get a new version out with a fix on monday.