From 0313db5a42d0b8187c8c642e48a36320bb76caf9 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 30 Sep 2018 13:44:50 +0200 Subject: [PATCH] panel: check gcinfo return values --- modules/panel.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/panel.lua b/modules/panel.lua index d1676795..4f68f7db 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -127,15 +127,15 @@ pfUI:RegisterModule("panel", function() end local memkb, gckb = gcinfo() - local memmb = round(memkb/1000, 2) - local gcmb = round(gckb/1000, 2) + local memmb = memkb and memkb > 0 and round((memkb or 0)/1000, 2) .. " MB" or UNAVAILABLE + local gcmb = gckb and gckb > 0 and round((gckb or 0)/1000, 2) .. " MB" or UNAVAILABLE local nin, nout, nping = GetNetStats() GameTooltip:AddDoubleLine(T["Active Addons"], "|cffffffff" .. active .. "|cff555555 / |cffffffff" .. GetNumAddOns()) GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine(T["Memory Usage"], "|cffffffff" .. memmb .. " MB") - GameTooltip:AddDoubleLine(T["Next Memory Cleanup"], "|cffffffff" .. gcmb .. " MB") + GameTooltip:AddDoubleLine(T["Memory Usage"], "|cffffffff" .. memmb) + GameTooltip:AddDoubleLine(T["Next Memory Cleanup"], "|cffffffff" .. gcmb) GameTooltip:AddLine(" ") GameTooltip:AddDoubleLine(T["Network Down"], "|cffffffff" .. round(nin,1) .. "KB/s") GameTooltip:AddDoubleLine(T["Network Up"], "|cffffffff" .. round(nout,1) .. "KB/s")