diff options
author | Zack Deveau <zack.ref@gmail.com> | 2022-11-29 14:40:43 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2022-11-30 16:27:39 -0500 |
commit | 4b9d10b8330b5072993f2c32eaf701c5c1aa7e55 (patch) | |
tree | 3a90ca9d6c00edf75ed82f631d4acbc9decc551c /struct.c | |
parent | 0d3fc08ff46cdfa389170db6141f1747d5d9d283 (diff) | |
download | ruby-4b9d10b8330b5072993f2c32eaf701c5c1aa7e55.tar.gz |
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.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -48,7 +48,7 @@ struct_ivar_get(VALUE c, ID id) for (;;) { 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; RUBY_ASSERT(RB_TYPE_P(c, T_CLASS)); ivar = rb_attr_get(c, id); |