From bf5d8403a781596ccd9bb897e702ad1d5e182b3d Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Wed, 3 Apr 2024 09:59:32 -0400 Subject: [PATCH] Fix crashes when analysing try node parents --- src/analyzer/stmt/try_analyzer.rs | 2 ++ src/code_info/data_flow/graph.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/analyzer/stmt/try_analyzer.rs b/src/analyzer/stmt/try_analyzer.rs index 5e518edd..01e788ae 100644 --- a/src/analyzer/stmt/try_analyzer.rs +++ b/src/analyzer/stmt/try_analyzer.rs @@ -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 diff --git a/src/code_info/data_flow/graph.rs b/src/code_info/data_flow/graph.rs index c891dac3..4177148a 100644 --- a/src/code_info/data_flow/graph.rs +++ b/src/code_info/data_flow/graph.rs @@ -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 {