summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-11-30 15:04:31 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2022-11-30 16:27:39 -0500
commit5752d11f1f33d277356373da749db111e03c96b5 (patch)
tree0d59152aa8fe241eb98f10dc85bddffc84420620 /struct.c
parent4b9d10b8330b5072993f2c32eaf701c5c1aa7e55 (diff)
downloadruby-5752d11f1f33d277356373da749db111e03c96b5.tar.gz
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.
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c2
1 files changed, 1 insertions, 1 deletions
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);