summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorÉtienne Barrié <[email protected]>2025-06-10 17:04:07 +0200
committerJean Boussier <[email protected]>2025-06-10 19:37:03 +0200
commitc54e96d651b53d4105447c3bb4fb94903bd67cc5 (patch)
treef9deb31020f4c99dcf5b8de2af6697e251bad9a5 /shape.c
parentbcb4fbe2ebba2efbea1933f0ac32b87dc48b2021 (diff)
Fix RubyVM::Shape.transition_tree
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13578
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/shape.c b/shape.c
index 668850cdd4..a7dff90ce3 100644
--- a/shape.c
+++ b/shape.c
@@ -1391,12 +1391,14 @@ static enum rb_id_table_iterator_result collect_keys_and_values(ID key, VALUE va
static VALUE edges(VALUE edges)
{
VALUE hash = rb_hash_new();
- if (SINGLE_CHILD_P(edges)) {
- rb_shape_t *child = SINGLE_CHILD(edges);
- collect_keys_and_values(child->edge_name, (VALUE)child, &hash);
- }
- else {
- rb_managed_id_table_foreach(edges, collect_keys_and_values, &hash);
+ if (edges) {
+ if (SINGLE_CHILD_P(edges)) {
+ rb_shape_t *child = SINGLE_CHILD(edges);
+ collect_keys_and_values(child->edge_name, (VALUE)child, &hash);
+ }
+ else {
+ rb_managed_id_table_foreach(edges, collect_keys_and_values, &hash);
+ }
}
return hash;
}