Core/Movement: Fix a potential crash on newly created pets.

Port From (https://github.com/TrinityCore/TrinityCore/commit/3d9d6fbcb80eaab72acbe6ef09b9b1c29f2439c7)
This commit is contained in:
hondacrx
2021-09-26 10:31:46 -04:00
parent ad1975b277
commit 9d5cf1d4ae
3 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -523,7 +523,7 @@ namespace Game.Entities
if (creature.HasUnitTypeMask(UnitTypeMask.Minion) && !creature.IsInCombat())
{
var top = creature.GetMotionMaster().Top();
var top = creature.GetMotionMaster().TopOrNull();
if (top != null && top.GetMovementGeneratorType() == MovementGeneratorType.Follow)
{
Unit followed = ((AbstractFollower)top).GetTarget();