From ef84e92e9a894f761f1b4ccd5897b6540e4fe714 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 10 May 2022 23:47:52 +0200 Subject: [PATCH] (Hopefully) fix a rare nil error when sorting cooldowns. Closes #4 (if it works). Thanks. --- data/cooldowns.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/data/cooldowns.lua b/data/cooldowns.lua index dd467eb..2adceb3 100644 --- a/data/cooldowns.lua +++ b/data/cooldowns.lua @@ -187,18 +187,22 @@ function Rekt:SortCDs(which) local i = 1; for k, v in pairs(self.cds[self.targets[which]]) do if not (k == "spec") then - tmp[i] = { + local ttmp = { currentTime = v[1], endTime = v[2], cd = v[3], spellIcon = v[4], spellID = v[5], spellCategory = v[6] - }; - - --self:Print(v[1] .. v[2] .. v[3] .. v[4] .. v[5]) - --self:Print(tmp[i]["currentTime"] .. " " .. tmp[i]["endTime"] .. " " .. tmp[i]["cd"]);-- .. " " .. tmp[i][4] .. " " .. tmp[i][5]) - i = i + 1; + }; + + if ttmp then + tmp[i] = ttmp; + + --self:Print(v[1] .. v[2] .. v[3] .. v[4] .. v[5]) + --self:Print(tmp[i]["currentTime"] .. " " .. tmp[i]["endTime"] .. " " .. tmp[i]["cd"]);-- .. " " .. tmp[i][4] .. " " .. tmp[i][5]) + i = i + 1; + end end end