diff --git a/module/mes/scm.mes b/module/mes/scm.mes index 3aaac56d..9beac54b 100644 --- a/module/mes/scm.mes +++ b/module/mes/scm.mes @@ -109,7 +109,7 @@ (define assv-ref assq-ref) (define (assoc key alist) - (if (null? alist) #f + (if (not (pair? alist)) #f (if (equal? key (caar alist)) (car alist) (assoc key (cdr alist))))) diff --git a/src/mes.c b/src/mes.c index 46544f70..c0aae433 100644 --- a/src/mes.c +++ b/src/mes.c @@ -713,6 +713,8 @@ call (SCM fn, SCM x) SCM assq (SCM x, SCM a) { + if (TYPE (a) != TPAIR) + return cell_f; switch (TYPE (x)) { case TCHAR: