Quantcast

Fix a bug when an icon is set to nil, or set to a texture from nil

James Whitehead II [01-11-10 - 07:43]
Fix a bug when an icon is set to nil, or set to a texture from nil
Filename
NinjaPanel.lua
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index 0ff531a..b87231b 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -261,6 +261,11 @@ function NinjaPanel:UpdatePlugin(event, name, key, value, dataobj)
 		self:UpdateButtonWidth(button)
 	elseif key == "icon" then
 		button.icon:SetTexture(value)
+        if value == nil then
+            button.icon:Hide()
+        else
+            button.icon:Show()
+        end
 	elseif key == "tooltip" or key == "OnTooltipShow" or key == "OnEnter" or key == "OnLeave" then
 		-- Update the tooltip handers on the frame
 		self:UpdateTooltipHandlers(button, dataobj)