Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5361/src
Modified Files: Tag: devel_0_39 g_canvas.c Log Message: avoid pd crash on loading bogus patcher files
Index: g_canvas.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v retrieving revision 1.4.4.1.2.7 retrieving revision 1.4.4.1.2.8 diff -C2 -d -r1.4.4.1.2.7 -r1.4.4.1.2.8 *** g_canvas.c 22 Aug 2005 16:28:25 -0000 1.4.4.1.2.7 --- g_canvas.c 30 Jun 2006 15:01:21 -0000 1.4.4.1.2.8 *************** *** 168,175 **** t_canvasenvironment *canvas_getenv(t_canvas *x) { ! if (!x) bug("canvas_getenv"); while (!x->gl_env) ! if (!(x = x->gl_owner)) bug("t_canvasenvironment", x); return (x->gl_env); } --- 168,183 ---- t_canvasenvironment *canvas_getenv(t_canvas *x) { ! if (!x) ! { ! bug("canvas_getenv"); ! return NULL; ! } ! while (!x->gl_env) ! if (!(x = x->gl_owner)) ! { bug("t_canvasenvironment", x); + return NULL; + } return (x->gl_env); } *************** *** 187,192 **** { t_canvasenvironment *e = canvas_getenv(canvas_getcurrent()); ! *argcp = e->ce_argc; ! *argvp = e->ce_argv; }
--- 195,209 ---- { t_canvasenvironment *e = canvas_getenv(canvas_getcurrent()); ! if(e != NULL) ! { ! *argcp = e->ce_argc; ! *argvp = e->ce_argv; ! } ! else ! { ! /* this should only happen when something goes wrong in canvas_getenv (bug!) */ ! *argcp = 0; ! *argvp = NULL; ! } }