aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-08 13:26:01 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-08 13:26:31 -0400
commitf1ccfd3c3d7d626087f70b8c5798110cd28b248a (patch)
treeffd00bd12e2d2b5e3e5cfdef3d5cdcd85768babe /src
parent0310123bc920874312968b498828bbd7bb3b3113 (diff)
downloadminetest-f1ccfd3c3d7d626087f70b8c5798110cd28b248a.tar.gz
minetest-f1ccfd3c3d7d626087f70b8c5798110cd28b248a.tar.bz2
minetest-f1ccfd3c3d7d626087f70b8c5798110cd28b248a.zip
Replace Wieldmesh::setItem assertion that could be triggered by the server with an error
Diffstat (limited to 'src')
-rw-r--r--src/wieldmesh.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index 63c09786b..f12771968 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -357,8 +357,13 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef)
def.wield_scale * WIELD_SCALE_FACTOR
/ (BS * f.visual_scale));
}
- for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
- assert(i < 6);
+ u32 material_count = m_meshnode->getMaterialCount();
+ if (material_count >= 6) {
+ errorstream << "WieldMeshSceneNode::setItem: Invalid material "
+ "count " << material_count << ", truncating to 6" << std::endl;
+ material_count = 6;
+ }
+ for (u32 i = 0; i < material_count; ++i) {
video::SMaterial &material = m_meshnode->getMaterial(i);
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
material.setFlag(video::EMF_BILINEAR_FILTER, m_bilinear_filter);