From 44bca676d0fb46bafe4789a27e37824e663d4c33 Mon Sep 17 00:00:00 2001 From: "jk.pu" Date: Tue, 25 Oct 2016 20:07:07 +0900 Subject: [PATCH] [iotcon] fix fail to retrieve platform info 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 --- src/iotcon/iotcon_utils.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/iotcon/iotcon_utils.cc b/src/iotcon/iotcon_utils.cc index fce0426d..96240497 100644 --- a/src/iotcon/iotcon_utils.cc +++ b/src/iotcon/iotcon_utils.cc @@ -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(); } -- 2.34.1