summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-12 13:34:24 +0200
committerMattes D <github@xoft.cz>2020-04-12 13:34:24 +0200
commitfb05ea7cf740ecd59b24d4f7417ad44c30ba53d5 (patch)
treec3723655ff577be1df26573405635d0280249ceb /src/Entities
parentRemoved extended ASCII, and added a check against it. (#4642) (diff)
downloadcuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.gz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.bz2
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.lz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.xz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.zst
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.zip
Diffstat (limited to 'src/Entities')
-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);
+ }
}
}