From a5e2d2fa3abe68c1f9546f8b3c91415b96bce625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Fri, 16 May 2003 11:26:06 +0000 Subject: fixed a bug in [packel] (for 0 length lists, and for indeces that were beyond the list-length) svn path=/trunk/externals/zexy/; revision=621 --- src/z_pack.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/z_pack.c b/src/z_pack.c index 22a74eb..8e1f8a1 100644 --- a/src/z_pack.c +++ b/src/z_pack.c @@ -276,8 +276,12 @@ static void packel_list(t_packel *x, t_symbol *s, int argc, t_atom *argv) t_atom *current; int pos = (mypos < 0)?(argc+mypos):(mypos-1); - if (pos < 0) pos = 0; - else if (pos >= argc) pos = argc - 1; + if(argc==0){ + if (pos==0||pos==-1)outlet_bang(x->x_obj.ob_outlet); + return; + } + + if (pos < 0 || pos >= argc)return; current = &(argv[pos]); -- cgit v1.2.1