diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-18 23:37:44 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:52 -0800 |
commit | 329f76d5e2732ab1c1b10223842d7816275c7e8b (patch) | |
tree | 1dade2fa3a078f3c4481eaa9cd93dda3877da00e /src/lisp/ao_lisp_stack.c | |
parent | 1999b2c915bd5b7df70cffa7777e411d3032d2d5 (diff) |
altos/lisp: Move stack recursion check after null check
Don't crash when printing null stack this way.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_stack.c')
-rw-r--r-- | src/lisp/ao_lisp_stack.c | 8 |
1 files changed, 4 insertions, 4 deletions
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"); |