View Single Post
07-21-16, 04:53 PM   #3
ceylina
A Wyrmkin Dreamwalker
Join Date: Oct 2014
Posts: 50
Originally Posted by TOM_RUS View Post
Some items return -1 as quality, that's why this error happens.
Noticed that. It explains then why line 730 in the blizzard addon

color = ITEM_QUALITY_COLORS[quality];

would error out.

I would still consider this a bad bug on their part. Why would quality ever return as -1 anyway?

It makes no sense because in UIParent.lua the table array for ITEM_QUALITY_COLORS is

ITEM_QUALITY_COLORS = { };
for i = 0, NUM_LE_ITEM_QUALITYS - 1 do
ITEM_QUALITY_COLORS[i] = { };
ITEM_QUALITY_COLORS[i].r,
ITEM_QUALITY_COLORS[i].g,
ITEM_QUALITY_COLORS[i].b,
ITEM_QUALITY_COLORS[i].hex = GetItemQualityColor(i);
ITEM_QUALITY_COLORS[i].hex = "|c"..ITEM_QUALITY_COLORS[i].hex;
end

So it should not even be possible to return quality as -1


LE_ITEM_QUALITY_POOR=0
LE_ITEM_QUALITY_COMMON=1
LE_ITEM_QUALITY_UNCOMMON=2
LE_ITEM_QUALITY_RARE=3
LE_ITEM_QUALITY_EPIC=4
LE_ITEM_QUALITY_LEGENDARY=5
LE_ITEM_QUALITY_ARTIFACT=6
LE_ITEM_QUALITY_HEIRLOOM=7
LE_ITEM_QUALITY_WOW_TOKEN=8
NUM_LE_ITEM_QUALITYS=9

So that array is saying from 0 to (9-1) so the indices range from 0 to 8 which is what is returned in the quality return...

Either way quality should never return -1 because it would cause color = ITEM_QUALITY_COLORS[quality]; to have an empty result which is what happens and why itemName:SetVertexColor(color.r, color.g, color.b); then dies

They need a check that says if quality is less than 0 set it to 0 or fix whatever allows it to return -1