mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Battle Pets: Fixed possible crash in packet handler
This commit is contained in:
@@ -115,7 +115,7 @@ public:
|
||||
|
||||
uint8 GetPetCount(uint32 species) const;
|
||||
|
||||
WorldPackets::BattlePet::BattlePetSlot* GetSlot(uint8 slot) { return &_slots[slot]; }
|
||||
WorldPackets::BattlePet::BattlePetSlot* GetSlot(uint8 slot) { return slot < _slots.size() ? &_slots[slot] : nullptr; }
|
||||
void UnlockSlot(uint8 slot);
|
||||
|
||||
WorldSession* GetOwner() const { return _owner; }
|
||||
|
||||
@@ -28,7 +28,8 @@ void WorldSession::HandleBattlePetRequestJournal(WorldPackets::BattlePet::Battle
|
||||
void WorldSession::HandleBattlePetSetBattleSlot(WorldPackets::BattlePet::BattlePetSetBattleSlot& battlePetSetBattleSlot)
|
||||
{
|
||||
if (BattlePetMgr::BattlePet* pet = GetBattlePetMgr()->GetPet(battlePetSetBattleSlot.PetGuid))
|
||||
GetBattlePetMgr()->GetSlot(battlePetSetBattleSlot.Slot)->Pet = pet->PacketInfo;
|
||||
if (WorldPackets::BattlePet::BattlePetSlot* slot = GetBattlePetMgr()->GetSlot(battlePetSetBattleSlot.Slot))
|
||||
slot->Pet = pet->PacketInfo;
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlePetModifyName(WorldPackets::BattlePet::BattlePetModifyName& battlePetModifyName)
|
||||
|
||||
Reference in New Issue
Block a user