summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index aea94320..aee22096 100644
--- a/lib.c
+++ b/lib.c
@@ -5107,7 +5107,15 @@ val keywordp(val sym)
val get_current_package(void)
{
- return cdr(lookup_var(nil, package_s));
+ val pkg_binding = lookup_var(nil, package_s);
+ val pkg = cdr(pkg_binding);
+ if (type(pkg) != PKG) {
+ rplacd(pkg_binding, user_package);
+ uw_throwf(error_s, lit("variable *package* non-package "
+ "value ~s (reset to sane value)"),
+ pkg, nao);
+ }
+ return pkg;
}
val func_f0(val env, val (*fun)(val))