Skip to content

Commit cd783f4

Browse files
authored
Merge pull request #739 from j-b-1-7/odin_coverity_issue_200639
ODIN_II: Fix coverity CID 200639
2 parents d5d990e + 12e68dc commit cd783f4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ODIN_II/SRC/parse_making_ast.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,17 +1891,20 @@ ast_node_t *newDefparam(ids /*id*/, ast_node_t *val, int line_number)
18911891
if(flag == 0)
18921892
{
18931893
ref_node = module_instantiations_instance[j];
1894-
if(strcmp(ref_node->children[1]->children[0]->types.identifier, module_instance_name) == 0)
1894+
if(module_instance_name != NULL)
18951895
{
1896-
if(ref_node->children[1]->children[2])
1897-
add_child_to_node(ref_node->children[1]->children[2], new_node);
1898-
else
1896+
if(strcmp(ref_node->children[1]->children[0]->types.identifier, module_instance_name) == 0)
18991897
{
1900-
ast_node_t* symbol_node = create_node_w_type(MODULE_PARAMETER_LIST, line_number, current_parse_file);
1901-
ref_node->children[1]->children[2] = symbol_node;
1902-
add_child_to_node(ref_node->children[1]->children[2], new_node);
1898+
if(ref_node->children[1]->children[2])
1899+
add_child_to_node(ref_node->children[1]->children[2], new_node);
1900+
else
1901+
{
1902+
ast_node_t* symbol_node = create_node_w_type(MODULE_PARAMETER_LIST, line_number, current_parse_file);
1903+
ref_node->children[1]->children[2] = symbol_node;
1904+
add_child_to_node(ref_node->children[1]->children[2], new_node);
1905+
}
1906+
flag = 1;
19031907
}
1904-
flag = 1;
19051908
}
19061909
}
19071910
}

0 commit comments

Comments
 (0)