From 9999cd3509dc95920bcc1f9e5e8ed95dab16617d Mon Sep 17 00:00:00 2001 From: ankitm3k Date: Mon, 30 Sep 2024 12:17:26 +0530 Subject: [PATCH] update: handling few edge cases for parsing --- onnxruntime/core/providers/openvino/backend_utils.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/onnxruntime/core/providers/openvino/backend_utils.cc b/onnxruntime/core/providers/openvino/backend_utils.cc index 4d9fbe09f118..7c040b50ff22 100644 --- a/onnxruntime/core/providers/openvino/backend_utils.cc +++ b/onnxruntime/core/providers/openvino/backend_utils.cc @@ -285,6 +285,10 @@ void LoadConfig(const std::string& filename, std::map& throw std::runtime_error("Unknown exception for config file \"" + filename + "\".\n"); } + if (json_config.empty()) { + ORT_THROW("Empty JSON content passed \"" + filename + "\"."); + } + for (auto item = json_config.cbegin(), end = json_config.cend(); item != end; ++item) { const std::string& deviceName = item.key(); const auto& item_value = item.value();