Caerdon Wardrobe

Caerdon Wardrobe

446k Downloads

CaerdonWardrobe/CaerdonAPI.lua:98: bad argument #1 to 'pairs' (table expected, got nil)

Slackluster opened this issue ยท 7 comments

commented

15x CaerdonWardrobe/CaerdonAPI.lua:98: bad argument #1 to 'pairs' (table expected, got nil)
[string "=[C]"]: in function pairs' [string "@CaerdonWardrobe/CaerdonAPI.lua"]:98: in function ProcessTooltipData'
[string "@CaerdonWardrobe/CaerdonItem.lua"]:472: in function GetTooltipData' [string "@CaerdonWardrobe/CaerdonItem.lua"]:809: in function GetCaerdonStatus'
[string "@CaerdonWardrobe/CaerdonWardrobe.lua"]:685: in function ProcessItem' [string "@CaerdonWardrobe/CaerdonWardrobe.lua"]:832: in function callbackFunction'
[string "@CaerdonWardrobe/types/EquipmentMixin.lua"]:56: in function LoadSources' [string "@CaerdonWardrobe/types/EquipmentMixin.lua"]:80: in function ContinueOnItemDataLoad'
[string "@CaerdonWardrobe/CaerdonItem.lua"]:137: in function <CaerdonWardrobe/CaerdonItem.lua:130>
[string "=[C]"]: in function xpcall' [string "@FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:76: in function FireCallbacks'
[string "@FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:35: in function <FrameXML/ObjectAPI/AsyncCallbackSystem.lua:31>
[string "=[C]"]: in function `resume'
[string "@CaerdonWardrobe/CaerdonWardrobe.lua"]:873: in function <CaerdonWardrobe/CaerdonWardrobe.lua:868>

Locals:
(*temporary) = nil
(*temporary) = "table expected, got nil"
= defined =[C]:-1

commented

Working great now! Thanks for that, and for the addon, it's amazing.

commented

I was able to get past the error by adding null checks:

--- CaerdonAPI.lua	2023-05-06 15:44:52.126788345 -0400
+++ /home/marshall/wow/_retail_/Interface/AddOns/CaerdonWardrobe/CaerdonAPI.lua	2023-05-06 15:53:33.076792223 -0400
@@ -87,6 +87,7 @@

 function CaerdonAPIMixin:ProcessTooltipData(tooltipData)
     if not tooltipData then return end
+    if not tooltipData.args then return end

     local data = {
         type = tooltipData.type,
--- CaerdonItem.lua	2023-05-06 15:44:52.130121679 -0400
+++ /home/marshall/wow/_retail_/Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua	2023-05-06 16:11:21.163466837 -0400
@@ -471,6 +471,7 @@
 	if not data.isCaerdonProcessed then
 		data = CaerdonAPI:ProcessTooltipData(data)
 	end
+	if not data then return tooltipData end

 	local isBattlePetShown = BattlePetTooltip:IsShown()
 	local lines = data.lines or {}

I have no idea of the consequences of this change, other than it seems to suppress the errors, and the Addon content seems to be showing.

I can only guess that the overall handling of nullity has changed somewhere.

commented

Got this error after accepting a quest:

Message: ...nterface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:143: attempt to call global 'GetNumRewardSpells' (a nil value)
Time: Sat May  6 16:19:41 2023
Count: 2
Stack: ...nterface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:143: attempt to call global 'GetNumRewardSpells' (a nil value)
[string "@Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua"]:143: in function `GetQuestInfo'
[string "@Interface/AddOns/CaerdonWardrobe/features/QuestLog.lua"]:125: in function `callbackFunction'
[string "@Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua"]:42: in function `LoadQuestRewardData'
[string "@Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua"]:85: in function `ContinueOnItemDataLoad'
[string "@Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua"]:152: in function <Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:145>
[string "=[C]"]: in function `xpcall'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:76: in function `FireCallbacks'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:35: in function <Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua:31>
[string "=[C]"]: in function `accessor'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:52: in function `AddCallback'
[string "@Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua"]:145: in function `ContinueOnItemLoad'
[string "@Interface/AddOns/CaerdonWardrobe/features/QuestLog.lua"]:118: in function <...terface/AddOns/CaerdonWardrobe/features/QuestLog.lua:109>
[string "=[C]"]: in function `xpcall'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:76: in function `FireCallbacks'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:35: in function <Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua:31>
[string "=[C]"]: in function `accessor'
[string "@Interface/FrameXML/ObjectAPI/AsyncCallbackSystem.lua"]:52: in function `AddCallback'
[string "@Interface/AddOns/CaerdonWardrobe/features/QuestLog.lua"]:109: in function `OnQuestInfoShowRewards'
[string "@Interface/AddOns/CaerdonWardrobe/features/QuestLog.lua"]:78: in function `handler'
[string "@Interface/AddOns/CaerdonWardrobe/CaerdonWardrobe.lua"]:861: in function <Interface/AddOns/CaerdonWardrobe/CaerdonWardrobe.lua:852>

Locals: self = <table> {
 ContinueOnItemDataLoad = <function> defined @Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:80
 GetQuestInfo = <function> defined @Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:97
 item = <table> {
 }
 ContinueWithCancelOnItemDataLoad = <function> defined @Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:89
 LoadQuestRewardData = <function> defined @Interface/AddOns/CaerdonWardrobe/types/QuestMixin.lua:16
}
item = <table> {
 GetItemLocation = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:104
 IsDataEvictable = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:302
 GetEquipLocation = <function> defined @Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:239
 HasItemLocationBankOrBags = <function> defined @Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:304
 GetItemData = <function> defined @Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:1118
 LockItem = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:171
 IsItemDataCached = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:291
 GetInventoryTypeName = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:285
 GetItemQualityColor = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:248
 Matches = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:66
 itemLink = "[Loa of Winds]"
 GetItemQuality = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:219
 Clear = <function> defined @Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:117
 GetItemIcon = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:183
 GetItemMaxStackSize = <function> defined @Interface/FrameXML/ObjectAPI/Item.lua:258
 GetSetID = <function> defined @Interface/AddOns/CaerdonWardrobe/CaerdonItem.lua:3

Not as severe, however.

commented

Ok, that function (GetNumRewardSpells) has been removed...

https://wowpedia.fandom.com/wiki/Patch_10.1.0/API_changes

This is all new to me, no idea if there's a suitable replacement.

commented

Again, if I just comment out any references to numQuestSpellRewards then it "works". I doubt it's a good solution though.

@Caerdon If you want to give some feedback here, I can try to do a proper PR. (Though given the lack of recent updates, I think we all understand if you don't have the time.)

commented

Been busy but taking a look :)

commented

Thanks again for digging in here! This should be resolved in v3.4.0!