small fix for certain linked items
Xruptor [09-12-16 - 19:42]
small fix for certain linked items
diff --git a/xanTooltipIcon.lua b/xanTooltipIcon.lua
index 4bb771e..11c68b2 100644
--- a/xanTooltipIcon.lua
+++ b/xanTooltipIcon.lua
@@ -12,15 +12,21 @@ local function showTooltipIcon(tooltip, link)
local linkType,id = link:match("^([^:]+):(%d+)")
if linkType == "achievement" and id then
- tooltip.button:SetNormalTexture(select(10,GetAchievementInfo(id)))
- tooltip.button.doOverlay:Show()
- tooltip.button.type = "achievement"
+ if GetAchievementInfo(id) and select(10,GetAchievementInfo(id)) then
+ tooltip.button:SetNormalTexture(select(10,GetAchievementInfo(id)))
+ tooltip.button.doOverlay:Show()
+ tooltip.button.type = "achievement"
+ end
elseif linkType == "spell" and id then
- tooltip.button:SetNormalTexture(select(3,GetSpellInfo(id)))
- tooltip.button.type = "spell"
+ if GetSpellInfo(id) and select(3,GetSpellInfo(id)) then
+ tooltip.button:SetNormalTexture(select(3,GetSpellInfo(id)))
+ tooltip.button.type = "spell"
+ end
else
- tooltip.button:SetNormalTexture(GetItemIcon(id))
- tooltip.button.type = "item"
+ if id and GetItemIcon(id) then
+ tooltip.button:SetNormalTexture(GetItemIcon(id))
+ tooltip.button.type = "item"
+ end
end
end
diff --git a/xanTooltipIcon.toc b/xanTooltipIcon.toc
index b03fd61..57904c1 100644
--- a/xanTooltipIcon.toc
+++ b/xanTooltipIcon.toc
@@ -2,6 +2,6 @@
## Title: XanTooltipIcon
## Notes: Adds an icon to tooltips for achievement or item chat links.
## Author: Xruptor
-## Version: 2.1
+## Version: 2.2
xanTooltipIcon.lua