summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/variable.c b/variable.c
index 926cdb9..aec1d92 100644
--- a/variable.c
+++ b/variable.c
@@ -816,11 +816,15 @@ generic_ivar_get(obj, id)
st_table *tbl;
VALUE val;
- if (!generic_iv_tbl) return Qnil;
- if (!st_lookup(generic_iv_tbl, obj, &tbl)) return Qnil;
- if (st_lookup(tbl, id, &val)) {
- return val;
+ if (generic_iv_tbl) {
+ if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (st_lookup(tbl, id, &val)) {
+ return val;
+ }
+ }
}
+
+ rb_warning("instance variable %s not initialized", rb_id2name(id));
return Qnil;
}