diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index e840f77a5..b5e3f7962 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -337,10 +337,19 @@ public: Player* player = handler->GetSession()->GetPlayer(); uint32 mapId = locationValues.size() >= 4 ? uint32(locationValues[3]) : player->GetMapId(); - Map const* map = sMapMgr->CreateBaseMap(mapId); float x = locationValues[0]; float y = locationValues[1]; + + if (mapId == MAPID_INVALID) + { + handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId); + handler->SetSentErrorMessage(true); + return false; + } + + Map const* map = sMapMgr->CreateBaseMap(mapId); + float z = locationValues.size() >= 3 ? locationValues[2] : std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); // map ID (locationValues[3]) already handled above float o = locationValues.size() >= 5 ? locationValues[4] : player->GetOrientation();