Core/Pet: Attempt to fix assertions triggered when summoning pets

Port From (https://github.com/TrinityCore/TrinityCore/commit/40d882b7544cff556f5e2dc6ac570c3fee5b9659)
This commit is contained in:
hondacrx
2022-03-10 10:23:06 -05:00
parent ae652fd03b
commit 5b805e2f60
2 changed files with 25 additions and 2 deletions
+4 -1
View File
@@ -4744,6 +4744,9 @@ namespace Game.Entities
return null;
}
if (petType == PetType.Summon && petStable.CurrentPet != null)
RemovePet(null, PetSaveMode.NotInSlot);
PhasingHandler.InheritPhaseShift(pet, this);
pet.SetCreatorGUID(GetGUID());
@@ -4836,7 +4839,7 @@ namespace Game.Entities
if (pet == null)
{
if (mode == PetSaveMode.NotInSlot && m_petStable.CurrentPet != null)
if (mode == PetSaveMode.NotInSlot && m_petStable?.CurrentPet != null)
{
// Handle removing pet while it is in "temporarily unsummoned" state, for example on mount
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID);