Skip to content

Commit

Permalink
Fix client crash on deletion of an object the clients localplayer is …
Browse files Browse the repository at this point in the history
…attached to
  • Loading branch information
sapier authored and sapier committed Jul 6, 2014
1 parent b459f53 commit 2e19af9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/content_cao.cpp
Expand Up @@ -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++)
Expand All @@ -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)
Expand Down

0 comments on commit 2e19af9

Please sign in to comment.