mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* 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().
This commit is contained in:
parent
e8293eb671
commit
0a284a4e88
1 changed files with 5 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue