Skip to content

Commit

Permalink
Fix crashes when analysing try node parents
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Apr 3, 2024
1 parent 95e7a95 commit bf5d840
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/analyzer/stmt/try_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ pub(crate) fn analyze(
false,
);

analysis_data.data_flow_graph.add_node(new_parent_node.clone());

catch_type.parent_nodes.push(new_parent_node);

catch_context
Expand Down
3 changes: 2 additions & 1 deletion src/code_info/data_flow/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ impl DataFlowGraph {
}
}

if self.get_node(from_id).is_some() {
if self.vertices.contains_key(from_id) || self.sources.contains_key(from_id)
{
if !visited_child_ids.contains(from_id) {
new_parent_nodes.insert(from_id.clone());
} else {
Expand Down

0 comments on commit bf5d840

Please sign in to comment.