summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-03-16 15:10:11 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-03-16 15:10:11 -0400
commit819f4f0e65b78c7a57b79a5e8c527adecc3c84d6 (patch)
treec7e066255b25a86319948b2e0582aec3d2220549 /class.c
parent6d8f396f37350b7aa9c85a097929f54a0939448b (diff)
downloadruby-819f4f0e65b78c7a57b79a5e8c527adecc3c84d6.tar.gz
Always skip dummy head of subclass in rb_prepend_module
The first node of the subclass linked list of always a dummy head, so it should be skipped.
Diffstat (limited to 'class.c')
-rw-r--r--class.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/class.c b/class.c
index 0acac96022..28743a229e 100644
--- a/class.c
+++ b/class.c
@@ -1353,7 +1353,7 @@ rb_prepend_module(VALUE klass, VALUE module)
if (RB_TYPE_P(klass, T_MODULE)) {
rb_subclass_entry_t *iclass = RCLASS_SUBCLASSES(klass);
// skip the placeholder subclass entry at the head of the list if it exists
- if (iclass && iclass->next) {
+ if (iclass) {
RUBY_ASSERT(!iclass->klass);
iclass = iclass->next;
}