From: Keith Packard Date: Sat, 19 Nov 2016 07:37:44 +0000 (-0800) Subject: altos/lisp: Move stack recursion check after null check X-Git-Tag: 1.7~125 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=sidebyside;h=329f76d5e2732ab1c1b10223842d7816275c7e8b;hp=1999b2c915bd5b7df70cffa7777e411d3032d2d5;p=fw%2Faltos altos/lisp: Move stack recursion check after null check Don't crash when printing null stack this way. Signed-off-by: Keith Packard --- diff --git a/src/lisp/ao_lisp_stack.c b/src/lisp/ao_lisp_stack.c index ef07b88a..53adf432 100644 --- a/src/lisp/ao_lisp_stack.c +++ b/src/lisp/ao_lisp_stack.c @@ -160,11 +160,11 @@ ao_lisp_stack_print(ao_poly poly) { struct ao_lisp_stack *s = ao_lisp_poly_stack(poly); - if (s->type & AO_LISP_STACK_PRINT) { - printf("[recurse...]"); - return; - } while (s) { + if (s->type & AO_LISP_STACK_PRINT) { + printf("[recurse...]"); + return; + } s->type |= AO_LISP_STACK_PRINT; printf("\t[\n"); printf("\t\texpr: "); ao_lisp_poly_print(s->list); printf("\n");