Core/Battle Pets: Fixed possible crash in packet handler
Port From (https://github.com/TrinityCore/TrinityCore/commit/ce8f9b9a4efc8a3f110465db5310f08067658f60)
This commit is contained in:
@@ -454,7 +454,7 @@ namespace Game.BattlePets
|
||||
_owner.SendPacket(battlePetError);
|
||||
}
|
||||
|
||||
public BattlePetSlot GetSlot(byte slot) { return _slots[slot]; }
|
||||
public BattlePetSlot GetSlot(byte slot) { return slot < _slots.Count ? _slots[slot] : null; }
|
||||
WorldSession GetOwner() { return _owner; }
|
||||
|
||||
public ushort GetTrapLevel() { return _trapLevel; }
|
||||
|
||||
@@ -35,7 +35,11 @@ namespace Game
|
||||
{
|
||||
BattlePetMgr.BattlePet pet = GetBattlePetMgr().GetPet(battlePetSetBattleSlot.PetGuid);
|
||||
if (pet != null)
|
||||
GetBattlePetMgr().GetSlot(battlePetSetBattleSlot.Slot).Pet = pet.PacketInfo;
|
||||
{
|
||||
BattlePetSlot slot = GetBattlePetMgr().GetSlot(battlePetSetBattleSlot.Slot);
|
||||
if (slot != null)
|
||||
slot.Pet = pet.PacketInfo;
|
||||
}
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.BattlePetModifyName)]
|
||||
|
||||
Reference in New Issue
Block a user