struct.c (struct_ivar_get): add conditional for potential Qnil returned by rb_class_superclass
struct_ivar_get recently started using rb_class_superclass to resolve super instead of RCLASS_SUPER. This change made Qnil a possible case we need to return from within the struct_ivar_get for loop.
This commit is contained in:
parent
0d3fc08ff4
commit
4b9d10b833
Notes:
git
2022-11-30 21:28:04 +00:00
2
struct.c
2
struct.c
@ -48,7 +48,7 @@ struct_ivar_get(VALUE c, ID id)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = rb_class_superclass(c);
|
c = rb_class_superclass(c);
|
||||||
if (c == 0 || c == rb_cStruct || c == rb_cData)
|
if (c == 0 || c == rb_cStruct || c == rb_cData || c == Qnil)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
RUBY_ASSERT(RB_TYPE_P(c, T_CLASS));
|
RUBY_ASSERT(RB_TYPE_P(c, T_CLASS));
|
||||||
ivar = rb_attr_get(c, id);
|
ivar = rb_attr_get(c, id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user