From 20e74b5e1fc6755ff460aff971a77d017e6060e1 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Wed, 13 May 2020 16:04:55 +0900 Subject: [PATCH] Handle exception cases to BindBackend This patch handles below two exception cases properly, - A case that user calls BindBackend second time. - A case that user calls BIndBackend with null parameter. Change-Id: Ia104226b81b5fcb56fe0111a5d74f27ec4d0ed01 Signed-off-by: Inki Dae --- src/inference_engine_common_impl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/inference_engine_common_impl.cpp b/src/inference_engine_common_impl.cpp index b6707e2..8ef900d 100755 --- a/src/inference_engine_common_impl.cpp +++ b/src/inference_engine_common_impl.cpp @@ -203,6 +203,16 @@ int InferenceEngineCommon::BindBackend(inference_engine_config *config) { LOGI("ENTER"); + if (mBackendHandle) { + LOGE("Already backend engine has been initialized."); + return INFERENCE_ENGINE_ERROR_INVALID_OPERATION; + } + + if (config == nullptr) { + LOGE("config object is invalid."); + return INFERENCE_ENGINE_ERROR_INVALID_PARAMETER; + } + if (mUseProfiler == true) { // Memory usage will be measured between BindBackend ~ UnbindBackend callbacks. mProfiler->Start(IE_PROFILER_MEMORY); -- 2.34.1