Core/Transmog: Fix crash happening when trying to apply artifact override transmog to characters still in Initial spec

Closes #31749
This commit is contained in:
Shauren
2026-03-24 19:15:43 +01:00
parent 201f4e09d1
commit 3950890159

View File

@@ -11878,12 +11878,17 @@ void Player::SetVisibleItemSlot(uint8 slot, Item const* item)
if (transmogSlotOption != TransmogOutfitSlotOption::None)
{
// check if artifact override is active
TransmogOutfitSlotOption artifactOption = static_cast<TransmogOutfitSlotOption>(AsUnderlyingType(TransmogOutfitSlotOption::ArtifactSpecOne) + GetPrimarySpecializationEntry()->OrderIndex);
TransmogMgr::TransmogOutfitSlotAndOptionInfo const* artifactSlotInfo = TransmogMgr::GetSlotAndOption(EquipmentSlots(slot), artifactOption);
if (artifactSlotInfo && static_cast<TransmogOutfitDisplayType>(*m_activePlayerData->ViewedOutfit->Slots[artifactSlotInfo->SlotIndex].AppearanceDisplayType) == TransmogOutfitDisplayType::Assigned)
static constexpr int32 MaxArtifactSpecializations = AsUnderlyingType(TransmogOutfitSlotOption::ArtifactSpecFour) - AsUnderlyingType(TransmogOutfitSlotOption::ArtifactSpecOne) + 1;
int32 specIndex = GetPrimarySpecializationEntry()->OrderIndex;
if (specIndex >= 0 && specIndex < MaxArtifactSpecializations)
{
transmogSlotOption = artifactOption;
slotInfo = artifactSlotInfo;
TransmogOutfitSlotOption artifactOption = static_cast<TransmogOutfitSlotOption>(AsUnderlyingType(TransmogOutfitSlotOption::ArtifactSpecOne) + specIndex);
TransmogMgr::TransmogOutfitSlotAndOptionInfo const* artifactSlotInfo = TransmogMgr::GetSlotAndOption(EquipmentSlots(slot), artifactOption);
if (artifactSlotInfo && static_cast<TransmogOutfitDisplayType>(*m_activePlayerData->ViewedOutfit->Slots[artifactSlotInfo->SlotIndex].AppearanceDisplayType) == TransmogOutfitDisplayType::Assigned)
{
transmogSlotOption = artifactOption;
slotInfo = artifactSlotInfo;
}
}
}