aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-03-26 19:14:25 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-03-26 19:14:25 +0000
commit5b126d345c2a13c1fc58e47ff906099fd416c743 (patch)
tree53806ed26722ad0eef7b6589c169864fd0f01d57
parentae70f3ae8077dbdac5c352382c151665b14098f4 (diff)
bugfix: [minmax] used to crash when an empty-list (not a bang) was sent to its left inlet
svn path=/trunk/externals/zexy/; revision=4771
-rw-r--r--src/minmax.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/minmax.c b/src/minmax.c
index f96b025..c44065d 100644
--- a/src/minmax.c
+++ b/src/minmax.c
@@ -37,19 +37,20 @@ static void minmax_bang(t_minmax *x)
static void minmax_list(t_minmax *x, t_symbol *s, int argc, t_atom *argv)
{
- t_float min = atom_getfloat(argv++);
- t_float max=min;
- argc--;
-
- while(argc--){
- t_float f = atom_getfloat(argv++);
- if (f<min)min=f;
- else if (f>max)max=f;
+ if(argc){
+ t_float min = atom_getfloat(argv++);
+ t_float max=min;
+ argc--;
+
+ while(argc--){
+ t_float f = atom_getfloat(argv++);
+ if (f<min)min=f;
+ else if (f>max)max=f;
+ }
+
+ x->min=min;
+ x->max=max;
}
-
- x->min=min;
- x->max=max;
-
minmax_bang(x);
}