aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2016-06-21 22:19:31 +0200
committerjackpoz <giacomopoz@gmail.com>2016-06-21 22:19:31 +0200
commit75319e4a6887f23562ac141e4494427793962b00 (patch)
treee376433e56f5519fcc0dfc13d3ee225aff9b6fd7 /src
parentbe6371fdc28e24d2fad73f6372c6a226971eceb5 (diff)
Core/Creature: Fix assertion triggered
Fix assertion triggered when a Creature was summoned at an invalid position with Auras loaded as Creature addons. Fix #17415
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index a11f4131dcf..5d19895824a 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -863,15 +863,17 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
//! returning correct zone id for selecting OutdoorPvP/Battlefield script
Relocate(x, y, z, ang);
- if (!CreateFromProto(guidlow, entry, data, vehId))
- return false;
-
+ // Check if the position is valid before calling CreateFromProto(), otherwise we might add Auras to Creatures at
+ // invalid position, triggering a crash about Auras not removed in the destructor
if (!IsPositionValid())
{
TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, entry, x, y, z, ang);
return false;
}
+ if (!CreateFromProto(guidlow, entry, data, vehId))
+ return false;
+
switch (GetCreatureTemplate()->rank)
{
case CREATURE_ELITE_RARE: