Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] fix segfault in compile_tool (#28434)

Dan Liuca38e5676761
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
index ff6dc6246a1..a23ba2b5990 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
@@ -19,14 +19,13 @@ public:
auto compilerType = config.get<COMPILER_TYPE>();
switch (compilerType) {
case ov::intel_npu::CompilerType::MLIR: {
- if (engineBackend->getName() != "LEVEL0") {
+ if (engineBackend == nullptr || engineBackend->getName() != "LEVEL0") {
return std::make_unique<PluginCompilerAdapter>(nullptr);
}
-
return std::make_unique<PluginCompilerAdapter>(engineBackend->getInitStructs());
}
case ov::intel_npu::CompilerType::DRIVER: {
- if (engineBackend->getName() != "LEVEL0") {
+ if (engineBackend == nullptr || engineBackend->getName() != "LEVEL0") {
OPENVINO_THROW("NPU Compiler Adapter must be used with LEVEL0 backend");
}