20b6934 - Fix old frame removal
[wowui.git] / OmaCD / Cooldowns.lua
index 3663615..9c7add4 100644 (file)
@@ -282,8 +282,10 @@ local function updatePlayer()
         idToGuid["player"] = guid;
     else
         idToGuid["player"] = nil;
-        for _, frame in pairs(frames[guid]) do
-            removeFrame(frame);
+        if frames[guid] then
+            for _, frame in pairs(frames[guid]) do
+                removeFrame(frame);
+            end
         end
     end
 end
@@ -378,25 +380,10 @@ end
 
 -- just check removals, don't cause inspects
 local function fastUpdateUnitids()
-    local size = 0;
-    local prefix = "solo";
-    if IsInGroup() then
-        if IsInRaid() then
-            size = 40;
-            prefix = "raid";
-        else
-            size = 4;
-            prefix = "party";
-        end
-    end
-    for i = 1,size do
-        local id = format("%s%i", prefix, i);
-        if not UnitExists(id) or UnitGroupRolesAssigned(id) ~= "HEALER" then
-            idToGuid[id] = nil;
-            if frames[guid] then
-                for _, frame in pairs(frames[guid]) do
-                    removeFrame(frame);
-                end
+    for guid, unitFrames in pairs(frames) do
+        if UnitGUID(guidToId[guid]) ~= guid then
+            for _, frame in pairs(unitFrames) do
+                removeFrame(frame);
             end
         end
     end