Eliote / SimpleAddonManager

A simple to use Addon Manager with profile, search, category filter, and more.
https://www.curseforge.com/wow/addons/simple-addon-manager
MIT License
4 stars 3 forks source link

[bug] Slash command produces `attempt to index field 'CategoryFrame' (a nil value)` #19

Closed tflo closed 1 year ago

tflo commented 1 year ago

When loading a set (profile) via slash command, I often – but not always – get this error:

attempt to index field 'CategoryFrame' (a nil value) ```text 9x SimpleAddonManager/CategoryFrame.lua:379: attempt to index field 'CategoryFrame' (a nil value) [string "@SimpleAddonManager/CategoryFrame.lua"]:379: in function `UpdateCategoryFrame' [string "@SimpleAddonManager/Core.lua"]:184: in function `Update' [string "@SimpleAddonManager/Profile.lua"]:102: in function `LoadAddonsFromProfile' [string "@SimpleAddonManager/SlashCommand.lua"]:42: in function `func' [string "@SimpleAddonManager/SlashCommand.lua"]:109: in function `?' [string "@DataStore/libs/AceConsole-3.0-7/AceConsole-3.0.lua"]:90: in function `?' [string "@FrameXML/ChatFrame.lua"]:5224: in function `ChatEdit_ParseText' [string "@FrameXML/ChatFrame.lua"]:4888: in function `ChatEdit_SendText' [string "@FrameXML/ChatFrame.lua"]:3132: in function [string "=[C]"]: in function `RunMacroText' [string "@FrameXML/SecureTemplates.lua"]:468: in function `handler' [string "@FrameXML/SecureTemplates.lua"]:690: in function ... [string "=[C]"]: in function `RunMacroText' [string "@FrameXML/SecureTemplates.lua"]:468: in function `handler' [string "@FrameXML/SecureTemplates.lua"]:690: in function [string "@FrameXML/SecureTemplates.lua"]:704: in function [string "@FrameXML/SecureTemplates.lua"]:746: in function [string "=[C]"]: ? [string "@FrameXML/SecureHandlers.lua"]:266: in function [string "=[C]"]: ? [string "@FrameXML/SecureHandlers.lua"]:296: in function [string "=(tail call)"]: ? Locals: self = SimpleAddonManager { 0 = DidAddonStateChanged = defined @SimpleAddonManager/MainFrame.lua:30 DisableAllAddOns = defined @SimpleAddonManager/Core.lua:304 GetTitleText = defined @SharedXML/PortraitFrame.lua:28 SetPortraitTexCoord = defined @SharedXML/PortraitFrame.lua:87 GetDb = defined @SimpleAddonManager/Core.lua:39 EnableAddOn = defined @SimpleAddonManager/Core.lua:289 CATEGORY_SIZE_W = 250 GetPlayerInfo = defined @SimpleAddonManager/Core.lua:311 TitleContainer = Frame { } UpdateOkButton = defined @SimpleAddonManager/MainFrame.lua:48 ValidateCategoryName = defined @SimpleAddonManager/CategoryFrame.lua:355 IsAddonInstalled = defined @SimpleAddonManager/Core.lua:284 RegisterModule = defined @SimpleAddonManager/Core.lua:262 ADDON_LOADED = defined @SimpleAddonManager/Core.lua:334 SetCharacter = defined @SimpleAddonManager/Core.lua:179 MIN_SIZE_W = 470 HookMenuButton = defined @SimpleAddonManager/Core.lua:381 SetPortraitAtlasRaw = defined @SharedXML/PortraitFrame.lua:83 Bg = SimpleAddonManagerBg { } ShowConfirmDialog = defined @SimpleAddonManager/Core.lua:154 NineSlice = Frame { } SetPortraitTextureSizeAndOffset = defined @SharedXML/PortraitFrame.lua:95 GetCharacter = defined @SimpleAddonManager/Core.lua:175 SetCategoryVisibility = defined @SimpleAddonManager/CategoryFrame.lua:384 PLAYER_ENTERING_WORLD = defined @SimpleAddonManager/Core.lua:365 IsAddonCollapsed = defined @SimpleAddonManager/Filters.lua:163 ShowInputDialog = defined @SimpleAddonManager/Core.lua:140 SetPortraitShown = defined @SharedXML/PortraitFrame.lua:91 GetModule = defined @SimpleAddonManager/Core.lua:271 SetPortraitTextureRaw = defined @SharedXML/PortraitFrame.lua:79 isMenuHooked = true ShowDialog = defined @SimpleAddonManager/Core.lua:106 UpdateCategoryFrame = defined @SimpleAddonManager/CategoryFrame.lua:378 EnableAllAddOns = defined @SimpleAddonManager/Core.lua:299 MIN_SIZE_H = 400 DisableAddOn = defined @SimpleAddonManager/Core.lua:294 SetTitleMaxLinesAndHeight = defined @SharedXML/PortraitFrame.lua:49 Initialize = defined @SimpleAddonManager/Core.lua:200 GetCategoryTable = defined @SimpleAddonManager/CategoryFrame.lua:362 DefaultPortraitTextureSizeAndOffset = defined @SharedXML/PortraitFrame.lua:101 LocalizeCategoryName = defined @SimpleAddonManager/CategoryFrame.lua:329 UpdateMemoryTickerPeriod = defined @SimpleAddonManager/AddonListFrame.lua:404 UpdateListFilters = defined @SimpleAddonManager/Filters.lua:300 GetAddonsList = defined @SimpleAddonManager/Filters.lua:296 ToggleAddonCollapsed = defined @SimpleAddonManager/Filters.lua:168 SetAddonCollapsed = defined @SimpleAddonManager/Filters.lua:156 FormatMemory = defined @SimpleAddonManager/Core.lua:252 SetBorder = defined @SharedXML/PortraitFrame.lua:62 layoutType = "PortraitFrameTemplate" DidAnyAddonStateChanged = defined @SimpleAddonManager/MainFrame.lua:40 TableKeysToSortedList = defined @SimpleAddonManage ```

I'm using the slash commands when logging out, for example in an OPie/M6 macro like this:

#icon inv_10_tailoring_bag2_color4
#label Std
/sam profile '130 Normal Std' ignore
#parse
/logout [mod:meta]
/stopmacro [mod]
/reload

But it can also happen if I enter the slash command manually in the chat. Despite the error, the profile is set correctly.

As said, the error does not appear always. It is possible that it depends on if I had opened the SAM GUI in that session, or if I did a reload somewhere before, not sure.

– Tom

Eliote commented 1 year ago

The command was trying to update the interface at the end of the process, which would not have being created if you never opened it. Should be fixed now.

tflo commented 1 year ago

Thanks for the fix.