From 0a284a4e88d63fccfe166998dcce0897f56a745d Mon Sep 17 00:00:00 2001 From: "Greg J. Badros" Date: Sun, 18 Jun 2000 21:47:23 +0000 Subject: * print.c (s_scm_current_pstate): Do not segfault when the print_state_pool is unitialized in `current-pstate', and better verify its state before altering it in scm_make_print_state(). --- libguile/print.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libguile/print.c') diff --git a/libguile/print.c b/libguile/print.c index 9c03035da..9a5734446 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -193,6 +193,9 @@ SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0, "`current-pstate' is only included in GUILE_DEBUG builds.") #define FUNC_NAME s_scm_current_pstate { + if (!print_state_pool || SCM_NCONSP(print_state_pool) + || SCM_NULLP(SCM_CDR(print_state_pool))) + return SCM_BOOL_F; return SCM_CADR (print_state_pool); } #undef FUNC_NAME @@ -222,7 +225,8 @@ scm_make_print_state () /* First try to allocate a print state from the pool */ SCM_DEFER_INTS; - if (SCM_NNULLP (SCM_CDR (print_state_pool))) + if (print_state_pool && SCM_CONSP(print_state_pool) && + SCM_NNULLP (SCM_CDR (print_state_pool))) { answer = SCM_CADR (print_state_pool); SCM_SETCDR (print_state_pool, SCM_CDDR (print_state_pool)); -- cgit v1.2.3