From 4b9d10b8330b5072993f2c32eaf701c5c1aa7e55 Mon Sep 17 00:00:00 2001 From: Zack Deveau Date: Tue, 29 Nov 2022 14:40:43 -0500 Subject: [PATCH] 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. --- struct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/struct.c b/struct.c index 10e5209fb9..9f7277e6b2 100644 --- a/struct.c +++ b/struct.c @@ -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);