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
3
struct.c
3
struct.c
|
@ -43,9 +43,10 @@ struct_ivar_get(VALUE c, ID id)
|
|||
return ivar;
|
||||
|
||||
for (;;) {
|
||||
c = RCLASS_SUPER(c);
|
||||
c = rb_class_superclass(c);
|
||||
if (c == 0 || c == rb_cStruct)
|
||||
return Qnil;
|
||||
RUBY_ASSERT(RB_TYPE_P(c, T_CLASS));
|
||||
ivar = rb_attr_get(c, id);
|
||||
if (!NIL_P(ivar)) {
|
||||
return rb_ivar_set(orig, id, ivar);
|
||||
|
|
Loading…
Add table
Reference in a new issue