summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index e7682e6da..3ff48440c 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1893,7 +1893,11 @@ void cEntity::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
if (!cRoot::Get()->GetPluginManager()->CallHookEntityTeleport(*this, m_LastPosition, Vector3d(a_PosX, a_PosY, a_PosZ)))
{
ResetPosition({a_PosX, a_PosY, a_PosZ});
- m_World->BroadcastTeleportEntity(*this);
+ auto world = m_World;
+ if (world != nullptr) // The entity might not be in a world yet (just spawned, in cWorld::m_EntitiesToAdd)
+ {
+ world->BroadcastTeleportEntity(*this);
+ }
}
}