aboutsummaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-07-06 22:11:21 +0200
committersapier <Sapier at GMX dot net>2014-07-06 22:11:21 +0200
commit2e19af99199a12bfabb751ed3c2a96bf8e3ab815 (patch)
treed66632853a14277203fc6e7216b67a1ac84ab412 /src/content_cao.cpp
parentb459f53ac366930f93928352833ea266fbfcd92e (diff)
downloadminetest-2e19af99199a12bfabb751ed3c2a96bf8e3ab815.tar.gz
minetest-2e19af99199a12bfabb751ed3c2a96bf8e3ab815.tar.bz2
minetest-2e19af99199a12bfabb751ed3c2a96bf8e3ab815.zip
Fix client crash on deletion of an object the clients localplayer is attached to
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index fe11d33da..02622f5b4 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -736,7 +736,8 @@ ClientActiveObject* GenericCAO::getParent()
void GenericCAO::removeFromScene(bool permanent)
{
- if((m_env != 0) && (permanent)) // Should be true when removing the object permanently and false when refreshing (eg: updating visuals)
+ // Should be true when removing the object permanently and false when refreshing (eg: updating visuals)
+ if((m_env != NULL) && (permanent))
{
for(std::vector<u16>::iterator ci = m_children.begin();
ci != m_children.end(); ci++)
@@ -747,6 +748,12 @@ void GenericCAO::removeFromScene(bool permanent)
}
m_env->m_attachements[getId()] = 0;
+
+ LocalPlayer* player = m_env->getLocalPlayer();
+ if (this == player->parent) {
+ player->parent = NULL;
+ player->isAttached = false;
+ }
}
if(m_meshnode)