diff options
author | Keith Packard <keithp@keithp.com> | 2016-11-18 23:37:44 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-11-18 23:37:44 -0800 |
commit | 86f1c4b04946956f40755286bd9554828d5c8728 (patch) | |
tree | bc2a2e5001a0a29babe849c2e080e9a6a61cfdf8 | |
parent | 8b1d8df85170e334f4f7691017629028fc88231a (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>
-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"); |