Skip to content

Commit

Permalink
Check node type before cast
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Dec 28, 2023
1 parent 7016ab8 commit 87e8e96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compile.c
Expand Up @@ -4679,8 +4679,10 @@ static_literal_value(const NODE *node, rb_iseq_t *iseq)
else {
return rb_fstring(RNODE_STR(node)->nd_lit);
}
default:
case NODE_LIT:
return RNODE_LIT(node)->nd_lit;
default:
rb_bug("unexpected node: %s", ruby_node_name(nd_type(node)));
}
}

Expand Down

0 comments on commit 87e8e96

Please sign in to comment.