From 5752d11f1f33d277356373da749db111e03c96b5 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 30 Nov 2022 15:04:31 -0500 Subject: Use RTEST and add test for GH-6832 Technically we shouldn't see Qfalse now, but RTEST also compiles down to just one branch anyways. Pretty contrived issue, but easy to fix. --- struct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 9f7277e6b2..6f67984cf2 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 || c == Qnil) + if (c == rb_cStruct || c == rb_cData || !RTEST(c)) return Qnil; RUBY_ASSERT(RB_TYPE_P(c, T_CLASS)); ivar = rb_attr_get(c, id); -- cgit v1.2.1