Even more fun
If I try and run
Code:
/dump AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubSubCategoryIndex].filters
with no auction categories open at all (meaning all those sections like weapons and armor not selected)
I get the error (this is with the auction house open to browse and no categories selected):
Code:
1x [string "return AuctionCategories[AuctionFrameBrowse..."]:1: attempt to index field '?' (a nil value)
[string "return AuctionCategories[AuctionFrameBrowse..."]:1: in function `func'
Blizzard_DebugTools\Dump.lua:389: in function `DevTools_DumpCommand'
FrameXML\ChatFrame.lua:2308: in function `?'
FrameXML\ChatFrame.lua:4332: in function <FrameXML\ChatFrame.lua:4279>
[C]: in function `ChatEdit_ParseText'
FrameXML\ChatFrame.lua:4000: in function `ChatEdit_SendText'
FrameXML\ChatFrame.lua:4036: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field '?' (a nil value)"
If I open a category, sub category, and sub sub category of armor / mail / head, I get this as a result
Code:
Dump: value=AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubCategoryIndex].subCategories[AuctionFrameBrowse.selectedSubSubCategoryIndex].filters
[1]={
[1]={
subClassID=3,
inventoryType=1,
classID=4
}
}
So there you go. Instead of returning nil and checking for that to make sure you don't error out, filter data setup around line 399 will throw an error that causes problems down the code chain.
Even just running /dump AuctionCategories[AuctionFrameBrowse.selectedCategoryIndex].filters does it without a category selected.
So therefore, is this code the bug?
Code:
local filterData;
if categoryIndex and subCategoryIndex and subSubCategoryIndex then
filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].subCategories[subSubCategoryIndex].filters;
elseif categoryIndex and subCategoryIndex then
filterData = AuctionCategories[categoryIndex].subCategories[subCategoryIndex].filters;
elseif categoryIndex then
filterData = AuctionCategories[categoryIndex].filters;
else
-- not filtering by category, leave nil for all
end
/dump AuctionFrameBrowse.selectedCategoryIndex without anything open category wise returns "empty result"