From 485f3f073d7d5fdd5a5d50f90c82938fa751cdd7 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 13 Nov 2016 19:36:40 +0100 Subject: [PATCH] xpbar: fix nil error for non rested players --- modules/xpbar.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/xpbar.lua b/modules/xpbar.lua index a5ddee90..af2f3769 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -47,9 +47,12 @@ pfUI:RegisterModule("xpbar", function () pfUI.xp:SetAlpha(1) local xp, xpmax, exh = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion() local xp_perc = round(xp / xpmax * 100) - local exh_perc = round(GetXPExhaustion() / xpmax * 100) local remaining = xpmax - xp local remaining_perc = round(remaining / xpmax * 100) + local exh_perc = 0 + if GetXPExhaustion() then + exh_perc = round(GetXPExhaustion() / xpmax * 100) + end GameTooltip:ClearLines() GameTooltip_SetDefaultAnchor(GameTooltip, this) @@ -60,7 +63,7 @@ pfUI:RegisterModule("xpbar", function () if IsResting() then GameTooltip:AddDoubleLine("Status", "|cffffffffResting") end - if GetXPExhaustion() > 0 then + if GetXPExhaustion() then GameTooltip:AddDoubleLine("Rested", "|cff5555ff+" .. exh .. " (" .. exh_perc .. "%)") end GameTooltip:Show()