summaryrefslogtreecommitdiff
path: root/src/wieldmesh.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2015-01-05 22:39:08 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-01-05 22:55:02 +1000
commitbeb6b3e5937160fab583f5dda2be53a651f0ec71 (patch)
tree09b0f12eb8762866bc8fb52ecae76a579423ff49 /src/wieldmesh.cpp
parent2d849b0a19af03913e564e2b6dbc36eecdd5ae0c (diff)
downloadminetest-beb6b3e5937160fab583f5dda2be53a651f0ec71.tar.gz
minetest-beb6b3e5937160fab583f5dda2be53a651f0ec71.tar.bz2
minetest-beb6b3e5937160fab583f5dda2be53a651f0ec71.zip
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
Diffstat (limited to 'src/wieldmesh.cpp')
-rw-r--r--src/wieldmesh.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index bde0b72af..4ddae36d4 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -411,20 +411,20 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
m_meshnode->setVisible(false);
m_meshnode->setMesh(dummymesh);
dummymesh->drop(); // m_meshnode grabbed it
- }
-
- if (m_lighting) {
- m_meshnode->setMesh(mesh);
} else {
- /*
- Lighting is disabled, this means the caller can (and probably will)
- call setColor later. We therefore need to clone the mesh so that
- setColor will only modify this scene node's mesh, not others'.
- */
- scene::IMeshManipulator *meshmanip = SceneManager->getMeshManipulator();
- scene::IMesh *new_mesh = meshmanip->createMeshCopy(mesh);
- m_meshnode->setMesh(new_mesh);
- new_mesh->drop(); // m_meshnode grabbed it
+ if (m_lighting) {
+ m_meshnode->setMesh(mesh);
+ } else {
+ /*
+ Lighting is disabled, this means the caller can (and probably will)
+ call setColor later. We therefore need to clone the mesh so that
+ setColor will only modify this scene node's mesh, not others'.
+ */
+ scene::IMeshManipulator *meshmanip = SceneManager->getMeshManipulator();
+ scene::IMesh *new_mesh = meshmanip->createMeshCopy(mesh);
+ m_meshnode->setMesh(new_mesh);
+ new_mesh->drop(); // m_meshnode grabbed it
+ }
}
m_meshnode->setMaterialFlag(video::EMF_LIGHTING, m_lighting);