mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Fix client crash on deletion of an object the clients localplayer is attached to
This commit is contained in:
parent
b459f53ac3
commit
2e19af9919
@ -736,7 +736,8 @@ ClientActiveObject* GenericCAO::getParent()
|
|||||||
|
|
||||||
void GenericCAO::removeFromScene(bool permanent)
|
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();
|
for(std::vector<u16>::iterator ci = m_children.begin();
|
||||||
ci != m_children.end(); ci++)
|
ci != m_children.end(); ci++)
|
||||||
@ -747,6 +748,12 @@ void GenericCAO::removeFromScene(bool permanent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_env->m_attachements[getId()] = 0;
|
m_env->m_attachements[getId()] = 0;
|
||||||
|
|
||||||
|
LocalPlayer* player = m_env->getLocalPlayer();
|
||||||
|
if (this == player->parent) {
|
||||||
|
player->parent = NULL;
|
||||||
|
player->isAttached = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_meshnode)
|
if(m_meshnode)
|
||||||
|
Loading…
Reference in New Issue
Block a user