From e41e4521be53a70e5a7c3f5de11b1a00be6355e9 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 12 Sep 2016 15:42:43 -0400 Subject: [PATCH] small fix for certain linked items --- xanTooltipIcon.lua | 20 +++++++++++++------- xanTooltipIcon.toc | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) 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 -- 1.7.9.5