From: Inki Dae Date: Wed, 13 May 2020 07:04:55 +0000 (+0900) Subject: Handle exception cases to BindBackend X-Git-Tag: submit/tizen/20200602.011936~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F233236%2F3;p=platform%2Fcore%2Fmultimedia%2Finference-engine-interface.git 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 --- 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);