From b9bb16f632d11f2196b27decb13c43b4de11719b Mon Sep 17 00:00:00 2001 From: Florian Berthold Date: Fri, 29 May 2026 10:43:54 +0200 Subject: [PATCH] fix(MultiCast): nil-safe Enum.ClassMask guard so file-load can't crash for custom classes --- Bartender4/MultiCastBar.lua | 13 ++++++++----- Bartender4/Options/MultiCastBar.lua | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Bartender4/MultiCastBar.lua b/Bartender4/MultiCastBar.lua index fc138b2..db25865 100644 --- a/Bartender4/MultiCastBar.lua +++ b/Bartender4/MultiCastBar.lua @@ -7,11 +7,14 @@ if not HasMultiCastActionBar then return end local classMask = UnitClassMask("player") --- CoA: the SHAMAN/HERO mask check doesn't know about CoA custom classes --- (e.g. Witchdoctor, which also uses the totem bar). Fall back to the --- game-created MultiCastActionBarFrame: if the engine produced it for this --- player, we wrap it regardless of class. -if not bit.contains(EnumUtil.CombineMasks(Enum.ClassMask.SHAMAN, Enum.ClassMask.HERO), classMask) +-- CoA: Enum.ClassMask only knows vanilla classes (SHAMAN/HERO); custom classes +-- (e.g. Witchdoctor) won't match. EnumUtil/Enum.ClassMask may also be nil on +-- this client. Guard both: if the mask API is unavailable OR the player's class +-- isn't in the vanilla set, fall through to the MultiCastActionBarFrame check — +-- if the engine created the bar for this player we wrap it regardless of class. +local _vanillaMask = EnumUtil and Enum and Enum.ClassMask + and EnumUtil.CombineMasks(Enum.ClassMask.SHAMAN, Enum.ClassMask.HERO) +if _vanillaMask and not bit.contains(_vanillaMask, classMask) and not MultiCastActionBarFrame then return end diff --git a/Bartender4/Options/MultiCastBar.lua b/Bartender4/Options/MultiCastBar.lua index 889a184..c968116 100644 --- a/Bartender4/Options/MultiCastBar.lua +++ b/Bartender4/Options/MultiCastBar.lua @@ -7,9 +7,12 @@ if not HasMultiCastActionBar then return end local classMask = UnitClassMask("player") --- CoA: see MultiCastBar.lua — same gate, same fallback so the options --- panel is registered for custom classes (e.g. Witchdoctor) too. -if not bit.contains(EnumUtil.CombineMasks(Enum.ClassMask.SHAMAN, Enum.ClassMask.HERO), classMask) +-- CoA: see MultiCastBar.lua — same gate, same fallback so the options panel is +-- registered for custom classes (e.g. Witchdoctor) too. Guard EnumUtil / +-- Enum.ClassMask for nil in case they are absent on this client. +local _vanillaMask = EnumUtil and Enum and Enum.ClassMask + and EnumUtil.CombineMasks(Enum.ClassMask.SHAMAN, Enum.ClassMask.HERO) +if _vanillaMask and not bit.contains(_vanillaMask, classMask) and not MultiCastActionBarFrame then return end