summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2023-10-14 10:57:47 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2023-10-15 16:16:06 +0900
commit5342dbf00bd87099a15e90d5375d44dff81493ac (patch)
tree58ea8000fa09521534c2f9a1f197694b5bd7d207 /parse.y
parente7e31d77848797703de60ea4aa095a3ec9e6c762 (diff)
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.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 09356ce596..0375f0b1d4 100644
--- a/parse.y
+++ b/parse.y
@@ -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) {