From aef9dd6536ebcb3bcf321e7dae47f1574acdfbb2 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sat, 2 Jun 2001 18:32:03 +0000 Subject: [PATCH] (apropos-fold, submodules, apropos): Be careful not to access unbound variables. --- ice-9/session.scm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ice-9/session.scm b/ice-9/session.scm index 87ad2c5f7..15290dff9 100644 --- a/ice-9/session.scm +++ b/ice-9/session.scm @@ -257,12 +257,14 @@ where OPTIONSET is one of debug, read, eval, print (display name) (display ": ") (display (car x)) - (cond ((procedure? (variable-ref (cdr x))) + (cond ((variable-bound? (cdr x)) + (let ((val (variable-ref (cdr x)))) + (cond ((or (procedure? val) value) + (display separator) + (display val))))) + (else (display separator) - (display (variable-ref (cdr x)))) - (value - (display separator) - (display (variable-ref (cdr x))))) + (display "(unbound)"))) (if (and shadow (not (eq? (module-ref module (car x)) @@ -313,7 +315,9 @@ Fourth arg FOLDER is one of data))) (module-filter (lambda (name var data) - (obarray-filter name (variable-ref var) data)))) + (if (variable-bound? var) + (obarray-filter name (variable-ref var) data) + data)))) (cond (module (hash-fold module-filter data (module-obarray module))) @@ -352,7 +356,7 @@ It is an image under the mapping EXTRACT." (define (submodules m) (hash-fold (lambda (name var data) - (let ((obj (variable-ref var))) + (let ((obj (and (variable-bound? var) (variable-ref var)))) (if (and (module? obj) (eq? (module-kind obj) 'directory)) (cons obj data)