raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=56dc04b019bc401ce6b581ee779dbb816ebef234
commit 56dc04b019bc401ce6b581ee779dbb816ebef234 Author: Carsten Haitzler (Rasterman) <[email protected]> Date: Fri Aug 22 19:55:45 2014 +0900 ehysics - fix potential divide by zero fix CID 1039435 --- src/lib/ephysics/ephysics_body.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/ephysics/ephysics_body.cpp b/src/lib/ephysics/ephysics_body.cpp index 48ef8cf..9e1e87c 100644 --- a/src/lib/ephysics/ephysics_body.cpp +++ b/src/lib/ephysics/ephysics_body.cpp @@ -1004,8 +1004,8 @@ _ephysics_body_soft_body_mass_set(EPhysics_Body *body, double mass) double inverse_mass; if (body->type == EPHYSICS_BODY_TYPE_SOFT) - body->soft_body->setTotalMass(mass); - else + body->soft_body->setTotalMass(mass); + else if (mass > 0.0) { valid_nodes = 0; for (int i = 0; i < body->soft_body->m_nodes.size(); i++) @@ -1015,12 +1015,15 @@ _ephysics_body_soft_body_mass_set(EPhysics_Body *body, double mass) valid_nodes++; } - inverse_mass = 1 / (mass / valid_nodes); - if (body->dragging_data.dragging) + if (valid_nodes > 0) { - valid_nodes++; inverse_mass = 1 / (mass / valid_nodes); - body->dragging_data.mass = inverse_mass; + if (body->dragging_data.dragging) + { + valid_nodes++; + inverse_mass = 1 / (mass / valid_nodes); + body->dragging_data.mass = inverse_mass; + } } for (int i = 0; i < body->soft_body->m_nodes.size(); i++) --
