fix(MoveAnything): nil-guard MAMover and MAMove frame loops - #108
Open
Xurkon wants to merge 1 commit into
Open
Conversation
Add nil checks in both loops that iterate over MAMover[1..20] and MAMove[1..17] global frames. MoveAnything only creates mover/move frames for whatever addons are currently enabled, so when ElvUI skins the addon at login with few/no other addons active, most of those _G entries are nil. Root cause: attempt to index field '?' (a nil value) when AddOnSkins' callback fires and tries to style MAMover* or MAMove* frames that don't yet exist. Side-effect fix: reusing moveFrame in SetPoint anchor instead of re-indexing _G[MAMove .. i].
There was a problem hiding this comment.
Pull request overview
This PR hardens the MoveAnything skin in ElvUI AddOnSkins by avoiding nil-index errors when MoveAnything hasn’t created the full set of expected mover/move frames at login.
Changes:
- Add nil-guards when iterating over
MAMover1..20frames before applying templates and hook scripts. - Add nil-guards when iterating over
MAMove1..17frames before applying templates/handling controls. - Use locals (
mover,moveFrame,backdrop) to reduce repeated global lookups in both loops.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add nil checks to both loops in the MoveAnything skin that iterate over
MAMover[1..20]andMAMove[1..17]global frames. Without these checks, ElvUI AddOnSkins throws a nil-index error when MoveAnything is enabled but few other addons are active at login.Root Cause Analysis
Error:
attempt to index field '?' (a nil value)Location:
ElvUI_AddOnSkins/Skins/Addons/moveAnything.lua, lines 29-32 and 49-52MoveAnything creates mover and move frames dynamically at runtime — one pair per addon it manages. It does not create 20 MAMover slots or 17 MAMove slots upfront; it only creates as many as there are enabled addons to move. When ElvUI's AddOnSkins callback fires at login, if only a handful of addons are enabled, the vast majority of
_G["MAMover" .. i]and_G["MAMove" .. i]entries arenil.The original code blindly indexed these globals without checking existence first:
Trigger conditions:
Fix
Guard both loops with existence checks before attempting to call methods on the frame objects:
Side-effect improvement: The second loop previously re-indexed
_G["MAMove" .. i]for theSetPointcall. The fix stores the frame in a local variable first, eliminating that redundant lookup.Testing