From 60da4a2ccda58129eb59591f82a8b73649864ef2 Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Mon, 21 Oct 2024 14:36:28 +0800 Subject: [PATCH] Fix SegFault (#22499) Fix SegFault reported by https://github.com/microsoft/onnxruntime/issues/22493. --- onnxruntime/core/optimizer/pre_shape_node_elimination.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/optimizer/pre_shape_node_elimination.cc b/onnxruntime/core/optimizer/pre_shape_node_elimination.cc index 23980c9c10..8f50ef7c09 100644 --- a/onnxruntime/core/optimizer/pre_shape_node_elimination.cc +++ b/onnxruntime/core/optimizer/pre_shape_node_elimination.cc @@ -48,7 +48,7 @@ bool PreShapeNodeElimination::SatisfyCondition(const Graph& graph, const Node& n for (const Node* next_node : output_nodes) { // Check if the next node is not of type "Shape" - if (!graph_utils::IsSupportedOptypeVersionAndDomain(*next_node, "Shape", {13, 15, 19}, kOnnxDomain)) { + if (!next_node || !graph_utils::IsSupportedOptypeVersionAndDomain(*next_node, "Shape", {13, 15, 19}, kOnnxDomain)) { return false; } }