Skip to content

Commit beb6b3e

Browse files
committedJan 5, 2015
Prevent client crashing if an NDT_AIRLIKE node is dropped
The player dropping the node can either be themselves or another player (i.e. without this fix you can crash other people's clients) Thanks CWz for reporting the issue
1 parent 2d849b0 commit beb6b3e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed
 

‎src/wieldmesh.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -411,20 +411,20 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
411411
m_meshnode->setVisible(false);
412412
m_meshnode->setMesh(dummymesh);
413413
dummymesh->drop(); // m_meshnode grabbed it
414-
}
415-
416-
if (m_lighting) {
417-
m_meshnode->setMesh(mesh);
418414
} else {
419-
/*
420-
Lighting is disabled, this means the caller can (and probably will)
421-
call setColor later. We therefore need to clone the mesh so that
422-
setColor will only modify this scene node's mesh, not others'.
423-
*/
424-
scene::IMeshManipulator *meshmanip = SceneManager->getMeshManipulator();
425-
scene::IMesh *new_mesh = meshmanip->createMeshCopy(mesh);
426-
m_meshnode->setMesh(new_mesh);
427-
new_mesh->drop(); // m_meshnode grabbed it
415+
if (m_lighting) {
416+
m_meshnode->setMesh(mesh);
417+
} else {
418+
/*
419+
Lighting is disabled, this means the caller can (and probably will)
420+
call setColor later. We therefore need to clone the mesh so that
421+
setColor will only modify this scene node's mesh, not others'.
422+
*/
423+
scene::IMeshManipulator *meshmanip = SceneManager->getMeshManipulator();
424+
scene::IMesh *new_mesh = meshmanip->createMeshCopy(mesh);
425+
m_meshnode->setMesh(new_mesh);
426+
new_mesh->drop(); // m_meshnode grabbed it
427+
}
428428
}
429429

430430
m_meshnode->setMaterialFlag(video::EMF_LIGHTING, m_lighting);

0 commit comments

Comments
 (0)