aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/Battleground.cpp
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-10-07 13:21:01 -0400
committermegamage <none@none.none>2011-10-07 13:21:01 -0400
commit381cf2f9d3a8bfddea02574987ff64e26d1889d4 (patch)
tree9a80134c6d7e588e2b34e7a3a64900b94b2e6c1d /src/server/game/Battlegrounds/Battleground.cpp
parentc89b1f6989ce1f5a48c48766993c3dd8101cc21b (diff)
Fix a crash caused by SetupBattleground when m_Map is not created.
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 5ab5aea30c1..ce555b3c503 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -437,6 +437,13 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
m_Events |= BG_STARTING_EVENT_1;
+ if(!FindBgMap())
+ {
+ sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
+ EndNow();
+ return;
+ }
+
// Setup here, only when at least one player has ported to the map
if (!SetupBattleground())
{
@@ -1407,7 +1414,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
// If the assert is called, means that m_BgObjects must be resized!
ASSERT(type < m_BgObjects.size());
- Map* map = GetBgMap();
+ Map* map = FindBgMap();
if (!map)
return false;
// Must be created this way, adding to godatamap would add it to the base map of the instance
@@ -1504,7 +1511,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
{
- if (Map* map = GetBgMap())
+ if (Map* map = FindBgMap())
if (GameObject* obj = map->GetGameObject(m_BgObjects[type]))
{
if (respawntime)
@@ -1523,7 +1530,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
// If the assert is called, means that m_BgCreatures must be resized!
ASSERT(type < m_BgCreatures.size());
- Map* map = GetBgMap();
+ Map* map = FindBgMap();
if (!map)
return NULL;