Skip to content

Commit

Permalink
Replace Wieldmesh::setItem assertion that could be triggered by the s…
Browse files Browse the repository at this point in the history
…erver with an error
  • Loading branch information
kwolekr committed May 8, 2015
1 parent 0310123 commit f1ccfd3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/wieldmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f1ccfd3

Please sign in to comment.