mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Don't attempt to read ivars on T_ICLASS in struct (#5664)
This commit is contained in:
parent
c3929b8c73
commit
adc709adb8
Notes:
git
2022-05-27 03:54:39 +09:00
Merged-By: jhawthorn <john@hawthorn.email>
1 changed files with 8 additions and 7 deletions
15
struct.c
15
struct.c
|
@ -43,13 +43,14 @@ struct_ivar_get(VALUE c, ID id)
|
||||||
return ivar;
|
return ivar;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = RCLASS_SUPER(c);
|
c = rb_class_superclass(c);
|
||||||
if (c == 0 || c == rb_cStruct)
|
if (c == 0 || c == rb_cStruct)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
ivar = rb_attr_get(c, id);
|
RUBY_ASSERT(RB_TYPE_P(c, T_CLASS));
|
||||||
if (!NIL_P(ivar)) {
|
ivar = rb_attr_get(c, id);
|
||||||
return rb_ivar_set(orig, id, ivar);
|
if (!NIL_P(ivar)) {
|
||||||
}
|
return rb_ivar_set(orig, id, ivar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue