Rarity

Rarity

17M Downloads

Unknown itemId causes errors in GUI.lua line 1198

lukem opened this issue ยท 2 comments

commented

Having a custom item with an unknown item ID causes the tooltip to fail:

1x Rarity\Core\GUI.lua:1198: Usage: GetItemInfo(itemID|"name"|"itemlink")
[string "=[C]"]: ?
[string "@Rarity\Core\GUI.lua"]:1198: in function <Rarity\Core\GUI.lua:1127>

This can be replicated by going to the "Custom" tab in Rarity, create new item item ID to track as 148790 (the Frightened Kodo), and then accessing the tooltip. This took a bit to debug which item was causing the problem - I forgot I had added that item ages ago, yet the crash only started occurring recently. Deleting the offending custom itemId and reloading the UI restores the tooltip.

Suggested fix is to ensure v.itemId is set, similar to other parts of the code:

--- GUI.lua.orig        2020-03-24 12:02:37.620279900 +1100
+++ GUI.lua     2020-03-24 11:54:40.692954900 +1100
@@ -1187 +1187 @@ local function addGroup(group, requiresG
-                                       if (not (R.db.profile.hideHighChance and (v.chance or 0) < 50)) and classGood then
+                                       if (not (R.db.profile.hideHighChance and (v.chance or 0) < 50)) and classGood and v.itemId then
commented

This error should be fixed in 5d2b4b1. Invalid item IDs will be ignored, either silently or with an error message detailing the item in question based on a newly-added setting in the Advanced/Experimental section of the addon's configuration.

Please let me know if there are any issues :)

commented

Thanks, this appears to be the same problem as was reported on WowAce.

I'm not really sure why this would suddenly cause an error but didn't before, so I'll have to look into it some more, now that I know how people are able to reproduce it.

Making sure there's no error is the easy part. It's more important to understand why this didn't happen previously even if the functionality shouldn't have changed.

I haven't had time to add a proper validation for item data but it's definitely something I want to do. This should make the addon more robust if bogus data was entered, like in your example :)