diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-04-10 12:15:28 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-04-10 12:15:28 +0000 |
commit | 05ebe3ceb8ab68ad6968ea46aa59b525484b1cda (patch) | |
tree | a3ff4b51b870cebec30909def3ea5a6a73942628 | |
parent | 81aaebcdc9432022b03af5895132f0d1d47c5171 (diff) |
add missing test on arg number
svn path=/trunk/externals/pmpd/; revision=17080
-rw-r--r-- | pmpd2d_core.c | 8 | ||||
-rw-r--r-- | pmpd3d_core.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pmpd2d_core.c b/pmpd2d_core.c index 5efaf19..3ff5bdd 100644 --- a/pmpd2d_core.c +++ b/pmpd2d_core.c @@ -230,12 +230,12 @@ void pmpd2d_link(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv) if (argc > 7) Lmax = atom_getfloatarg(7, argc, argv); // post("%d,%d, %f,%f", mass1, mass2, K, D); - if ( ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) ) + if ( ( argc > 2 ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) ) { pmpd2d_create_link(x, Id, mass1, mass2, K, D, Pow, Lmin, Lmax, 0); } else - if ( ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_FLOAT ) ) + if ( ( argc > 2 ) && ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -246,7 +246,7 @@ void pmpd2d_link(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv) } } else - if ( ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_SYMBOL ) ) + if ( ( argc > 2 ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -257,7 +257,7 @@ void pmpd2d_link(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv) } } else - if ( ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_SYMBOL ) ) + if ( ( argc > 2 ) && ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_SYMBOL ) ) { for (i=0; i < x->nb_mass; i++) { diff --git a/pmpd3d_core.c b/pmpd3d_core.c index 2da8ba8..9ec176b 100644 --- a/pmpd3d_core.c +++ b/pmpd3d_core.c @@ -394,7 +394,7 @@ void pmpd3d_tabLink(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) t_float Dl = atom_getfloatarg(6, argc, argv); if (Dl <= 0) Dl = 1; - if ( ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) ) + if ( ( argc > 2 ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) ) { pmpd3d_create_link(x, Id, mass1, mass2, 1, 1, 1, 0, 1000000, 2); x->link[x->nb_link-1].arrayK = arrayK; @@ -402,7 +402,7 @@ void pmpd3d_tabLink(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->link[x->nb_link-1].K_L = Kl; x->link[x->nb_link-1].D_L = Dl; } - else if ( ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_FLOAT ) ) + else if ( ( argc > 2 ) && ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -416,7 +416,7 @@ void pmpd3d_tabLink(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - else if ( ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_SYMBOL ) ) + else if ( ( argc > 2 ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -430,7 +430,7 @@ void pmpd3d_tabLink(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - else if ( ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_SYMBOL ) ) + else if ( ( argc > 2 ) && ( argv[1].a_type == A_SYMBOL ) && ( argv[2].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { |