Check node type before accessing nd_next

This is also a preparation for removing not_used members from
STR NODE. Current codes work without node type check because NODE_STR
has not_used2 member corresponding to nd_next of NODE_LIST and
NODE_DSTR. However it causes problme once not_used members are
removed from NODE_STR.
This commit is contained in:
yui-knk 2023-10-14 10:57:47 +09:00 committed by Yuichiro Kaneko
parent e7e31d7784
commit 5342dbf00b

View File

@ -8830,7 +8830,7 @@ heredoc_dedent(struct parser_params *p, NODE *root)
}
str_node = 0;
while ((node = RNODE_LIST(prev_node = node)->nd_next) != 0) {
while ((nd_type_p(node, NODE_LIST) || nd_type_p(node, NODE_DSTR)) && (node = RNODE_LIST(prev_node = node)->nd_next) != 0) {
next_str:
if (!nd_type_p(node, NODE_LIST)) break;
if ((str_node = RNODE_LIST(node)->nd_head) != 0) {