Fix json non exist member parse 48/279748/3 sandbox/pcd-acr
authorKwanghoon Son <k.son@samsung.com>
Wed, 17 Aug 2022 06:45:22 +0000 (02:45 -0400)
committerKwanghoon Son <k.son@samsung.com>
Wed, 17 Aug 2022 06:50:26 +0000 (02:50 -0400)
[Version] : 0.23.16
[Issue type] : bug fix

top_number, threshold optional member.
If member not exist, use default value

Change-Id: I96f67d5e541ce5dcaacae760e3332b745c5a3654
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
mv_machine_learning/inference/include/ScoreInfo.h
packaging/capi-media-vision.spec

index e3e3393..2004002 100644 (file)
@@ -95,11 +95,14 @@ namespace inference
                                        if (static_cast<int>(json_array_get_int_element(array, elem2)) == 1)
                                                dimInfo.SetValidIndex(elem2);
                                }
-
-                               topNumber = static_cast<int>(json_object_get_int_member(pObject, "top_number"));
+                               if (json_object_has_member(pObject, "top_number"))
+                                       topNumber = static_cast<int>(
+                                                       json_object_get_int_member(pObject, "top_number"));
                                LOGI("top number: %d", topNumber);
 
-                               threshold = static_cast<double>(json_object_get_double_member(pObject, "threshold"));
+                               if (json_object_has_member(pObject, "threshold"))
+                                       threshold = static_cast<double>(
+                                                       json_object_get_double_member(pObject, "threshold"));
                                LOGI("threshold: %1.3f", threshold);
 
                                try {
index 41b16b2..a1724ff 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.23.15
+Version:     0.23.16
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause