summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index a6910985fa..b902fef003 100644
--- a/variable.c
+++ b/variable.c
@@ -3361,8 +3361,13 @@ rb_mod_remove_cvar(VALUE mod, VALUE name)
VALUE
rb_iv_get(VALUE obj, const char *name)
{
- ID id = rb_intern(name);
+ ID id = rb_check_id_cstr(name, strlen(name), rb_usascii_encoding());
+ if (!id) {
+ if (RTEST(ruby_verbose))
+ rb_warning("instance variable %s not initialized", name);
+ return Qnil;
+ }
return rb_ivar_get(obj, id);
}