- frame.health:Show();
- -- sanity check, occasionally UnitHealthMax gives zero
- if current > max then
- -- somehow current health has gone over the maximum (missed maxhealth event)
- frame.health.max = UnitHealthMax(unit);
- max = frame.health.max;
- if current > max then
- -- error state, still over maximum
- frame.health:SetWidth(width);
- return;
- end
- elseif max > 0 then
- frame.health:SetWidth(current/frame.health.max*width);
- else
+ if current > max or max <= 0 then
+ -- somehow current health has gone over the maximum (missed maxhealth event possibly)
+ -- just put health bar full and update max health for next event