[10.1] attempt to index field 'args' (a nil value) in API.lua
Malivil opened this issue ยท 3 comments
Getting this error in Scrap when opening bags after doing some Timewalking dungeons after the 10.1 patch
Message: Interface/AddOns/Scrap/libs/ItemSearch-1.3/API.lua:53: attempt to index field 'args' (a nil value)
{
Time: Wed May 3 10:42:03 2023
Count: 10
Stack: Interface/AddOns/Scrap/libs/ItemSearch-1.3/API.lua:53: attempt to index field 'args' (a nil value)
[string "@Interface/AddOns/Scrap/libs/ItemSearch-1.3/API.lua"]:53: in function <Interface/AddOns/Scrap/libs/ItemSearch-1.3/API.lua:50>
[string "@Interface/AddOns/Scrap/libs/ItemSearch-1.3/API.lua"]:58: in functionIsUnusable' [string "@Interface/AddOns/Scrap/addons/main/main.lua"]:141: in function
IsFiltered'
[string "@Interface/AddOns/Scrap/addons/main/main.lua"]:75: in functionIsJunk' [string "@Interface/AddOns/Scrap/addons/main/spotlight.lua"]:57: in function
UpdateButton'
[string "@Interface/AddOns/Scrap/addons/main/spotlight.lua"]:49: in functioncall' [string "@Interface/AddOns/Scrap/addons/main/spotlight.lua"]:75: in function
IterateFrames'
[string "@Interface/AddOns/Scrap/addons/main/spotlight.lua"]:48: in functionUpdateContainer' [string "@Interface/AddOns/Scrap/addons/main/spotlight.lua"]:34: in function <Interface/AddOns/Scrap/addons/main/spotlight.lua:34> [string "=[C]"]: in function
Update'
[string "@Interface/FrameXML/ContainerFrame.lua"]:1126: in functionContainerFrame_GenerateFrame' [string "@Interface/FrameXML/ContainerFrame.lua"]:191: in function <Interface/FrameXML/ContainerFrame.lua:185> [string "@Interface/FrameXML/ContainerFrame.lua"]:207: in function
OpenBag'
[string "@Interface/FrameXML/ContainerFrame.lua"]:1828: in function <Interface/FrameXML/ContainerFrame.lua:1821>
[string "@Interface/FrameXML/ContainerFrame.lua"]:1884: in function <Interface/FrameXML/ContainerFrame.lua:1855>
[string "=[C]"]: in function `ToggleAllBags'
[string "OPENALLBAGS"]:1: in function <[string "OPENALLBAGS"]:1>
Locals: lines =
1 ={
}
2 ={
}
3 ={
}
4 ={
}
5 ={
}
6 ={
}
7 ={
}
8 ={
}
9 ={
}
10 ={
}
}
(for index) = 9
(for limit) = 5
(for step) = -1
i = 9
(*temporary) = nil
(*temporary) ={
leftText = ""
maxPrice = -1
price = 303
leftColor ={
}
type = 11
}
(*temporary) = -1
(temporary) = 0
(temporary) = "attempt to index field 'args' (a nil value)"
C ={
TooltipInfo ={
}
CurrencyInfo ={
}
Container ={
}
}
id = 127552
L ={
CLASS_REQUIREMENT = "Classes: (.)"
PLAYER_CLASS = "Rogue"
IN_SET = "Equipment Sets: (.)"
}
I am temporarily working around the error by updating function Lib:IsUnusable(id)
in API.lua to this, but it's unclear what the side effects are:
function Lib:IsUnusable(id)
if Unfit:IsItemUnusable(id) then
return true
elseif Lib.Unusable[id] == nil and IsEquippableItem(id) then
Lib.Unusable[id] = (function()
local lines = C.TooltipInfo.GetItemByID(id).lines
for i = #lines-1, 5, -1 do
if lines[i].args then
local class = lines[i].args[2].stringVal:match(L.CLASS_REQUIREMENT)
if class then
return not class:find(L.PLAYER_CLASS)
end
end
end
end)() or false
end
return Lib.Unusable[id]
end
I am temporarily working around the error by updating
function Lib:IsUnusable(id)
in API.lua to this, but it's unclear what the side effects are:
Looks like lines[i].args is always nil, so it will no longer add a red border if your class can't equip the item.
I changed the line to local class = lines[i].leftText:match(L.CLASS_REQUIREMENT)
instead and it seems to be working correctly
Fixed by 3f949a9