aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 8ffcfdf3ff..b945042983 100644
--- a/hash.c
+++ b/hash.c
@@ -1759,6 +1759,9 @@ env_aset(VALUE obj, VALUE nm, VALUE val)
rb_raise(rb_eSecurityError, "can't change environment variable");
}
+ if (NIL_P(val)) {
+ rb_raise(rb_eTypeError, "cannot assign nil; use Hash#delete instead");
+ }
StringValue(nm);
StringValue(val);
name = RSTRING(nm)->ptr;