[iotcon] fix fail to retrieve platform info 16/93716/1
authorjk.pu <jk.pu@samsung.com>
Tue, 25 Oct 2016 11:07:07 +0000 (20:07 +0900)
committerjk.pu <jk.pu@samsung.com>
Tue, 25 Oct 2016 11:09:01 +0000 (20:09 +0900)
if some device or platform value is null . it return error callback.
fix to return empty string.

Change-Id: I9eb890d752055a0e4e664b345bb8b237b3e06c24
Signed-off-by: jk.pu <jk.pu@samsung.com>
src/iotcon/iotcon_utils.cc

index fce0426..9624049 100644 (file)
@@ -1783,11 +1783,13 @@ common::TizenResult IotconUtils::PlatformInfoGetProperty(iotcon_platform_info_h
                                                                      &property));
   if (!result) {
     LogAndReturnTizenError(result, ("iotcon_platform_info_get_property() failed"));
-  } else if (!property) {
-    // TODO check if it should be an error or rather it should be ignored and used some default value
-    LogAndReturnTizenError(common::AbortError("iotcon_platform_info_get_property() returned no result"));
   }
-  out->insert(std::make_pair(name, picojson::value{property}));
+
+  if (!property) {
+    out->insert(std::make_pair(name, picojson::value{""}));
+  }else{
+    out->insert(std::make_pair(name, picojson::value{property}));
+ }
 
   return TizenSuccess();
 }
@@ -1907,10 +1909,15 @@ common::TizenResult IotconUtils::DeviceInfoGetProperty(iotcon_device_info_h devi
   auto result = ConvertIotconError(iotcon_device_info_get_property(device,
                                                                    property_e,
                                                                    &property));
-  if (!result || !property) {
+  if (!result ) {
     LogAndReturnTizenError(result, ("iotcon_device_info_get_property() failed"));
   }
-  out->insert(std::make_pair(name, picojson::value{property}));
+
+  if (!property) {
+    out->insert(std::make_pair(name, picojson::value{""}));
+  }else{
+    out->insert(std::make_pair(name, picojson::value{property}));
+  }
 
   return TizenSuccess();
 }