BetterBags

BetterBags

1M Downloads

categories:AddItemToCategory rejects uncached items

SpareSimian opened this issue ยท 6 comments

commented

Addon Version

v0.1.14

World of Warcraft Version

Retail

Describe the bug

I'm attempting to import my AdiBags item list and AddItemToCategory throws an assert because 86579 (Bottled Tornado) is not in the item cache (GetItemInfoInstant returns nil in categories.lua at line 54).

Steps to reproduce

API call from another addon. I'll try to create the repo for it shortly and add a link. For now I'll comment out the assert.

commented

GetItemInfoInstant always returns a valid response for an item, as there is no cache to hit -- it's using the local game data files to get the result, hence the "instant" part of the name. Can you show me the error you are getting?

commented

Just checked, this item is indeed no longer a valid item in WoW, and has been converted to a toy. This function is working as intended, and your list should be updated.

commented

You should validate it in your addon/plugin instead -- call the same function and decide what you want to do with invalid items. The code is a hard block and alert to developers that they are doing something incorrect.

commented

The list is from AdiBags, so if you get around to adding a migration routine, you're going to hit the same issue when you start importing old items from it. Blizzard is always retiring items, so you'll get bitten by it again in the future. At least change it from an assert to a warning in chat and ignore the addition. But I'll bet I have some of that stuff in my bags on other servers.

commented

With that line commented out, this addon can move the categories over. https://github.com/SpareSimian/BetterBagsFromAdiBags

commented

I'll bet I have some of that stuff in my bags on other servers.

You won't have a removed/converted item in your bags - but old Adibags categories may still have a reference to them.