Check if a given property is valid or not 31/233231/1
authorInki Dae <inki.dae@samsung.com>
Wed, 13 May 2020 06:18:33 +0000 (15:18 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 13 May 2020 06:18:33 +0000 (15:18 +0900)
Change-Id: Icd7ba4c1a68fbd215bb075fdd2e8255544dec86b
Signed-off-by: Inki Dae <inki.dae@samsung.com>
src/inference_engine_common_impl.cpp

index 2afd8f1..8b7371b 100755 (executable)
@@ -361,6 +361,11 @@ int InferenceEngineCommon::SetInputLayerProperty(inference_engine_layer_property
 {
        CHECK_ENGINE_INSTANCE(mBackendHandle);
 
+       if (property.layer_names.empty() || property.tensor_infos.empty()) {
+               LOGE("layer_names or tensor_infos vector of a given property is empty.");
+               return INFERENCE_ENGINE_ERROR_INVALID_PARAMETER;
+       }
+
        int ret = CheckLayerProperty(property);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Given input layer property is invalid.");
@@ -374,6 +379,11 @@ int InferenceEngineCommon::SetOutputLayerProperty(inference_engine_layer_propert
 {
        CHECK_ENGINE_INSTANCE(mBackendHandle);
 
+       if (property.layer_names.empty()) {
+               LOGE("layer_names vector of a given property is empty.");
+               return INFERENCE_ENGINE_ERROR_INVALID_PARAMETER;
+       }
+
        int ret = CheckLayerProperty(property);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Given output layer property is invalid.");