From 08b61bd8350daef7499bae14ecb00d012b342ea4 Mon Sep 17 00:00:00 2001 From: Cyrille Henry Date: Sat, 16 Feb 2013 18:41:00 +0000 Subject: bugfix svn path=/trunk/externals/pmpd/; revision=17037 --- pmpd3d_various.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pmpd3d_various.c') diff --git a/pmpd3d_various.c b/pmpd3d_various.c index 5b1915c..912dd00 100644 --- a/pmpd3d_various.c +++ b/pmpd3d_various.c @@ -469,13 +469,13 @@ void pmpd3d_forcesXT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { if ( argc == 1 ) // apply forces on all masses { - j = max(x->nb_mass, npoints); + j = min(x->nb_mass, npoints); for (i=0; i< j; i++) { x->mass[i].forceX += vec[i].w_float; } } - else if ( argv[1].a_type == A_SYMBOL ) + else if (( argc > 1 ) && ( argv[1].a_type == A_SYMBOL )) { i=0; j=0; @@ -515,13 +515,13 @@ void pmpd3d_forcesYT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { if ( argc == 1 ) // apply forces on all masses { - j = max(x->nb_mass, npoints); + j = min(x->nb_mass, npoints); for (i=0; i< j; i++) { x->mass[i].forceY += vec[i].w_float; } } - else if ( argv[1].a_type == A_SYMBOL ) + else if (( argc > 1 ) && (argv[1].a_type == A_SYMBOL )) { i=0; j=0; @@ -561,13 +561,13 @@ void pmpd3d_forcesZT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { if ( argc == 1 ) // apply forces on all masses { - j = max(x->nb_mass, npoints); + j = min(x->nb_mass, npoints); for (i=0; i< j; i++) { x->mass[i].forceZ += vec[i].w_float; } } - else if ( argv[1].a_type == A_SYMBOL ) + else if (( argc > 1 ) && ( argv[1].a_type == A_SYMBOL )) { i=0; j=0; -- cgit v1.2.1