diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/icl-payload.c | 18 | ||||
-rw-r--r-- | lib/icl-response.c | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/icl-payload.c b/lib/icl-payload.c index 769e958..4e50ada 100644 --- a/lib/icl-payload.c +++ b/lib/icl-payload.c @@ -158,6 +158,21 @@ static GVariant* _icl_state_value_to_gvariant(GHashTable *hash) } +static GVariant* _icl_representation_empty_gvariant(void) +{ + GVariant *value; + GVariantBuilder types, repr, children; + + g_variant_builder_init(&types, G_VARIANT_TYPE("as")); + g_variant_builder_init(&repr, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&children, G_VARIANT_TYPE("av")); + + value = g_variant_new("(siasa{sv}av)", IC_STR_NULL, 0, &types, &repr, &children); + + return value; +} + + GVariant* icl_representation_to_gvariant(iotcon_representation_h repr) { GList *node; @@ -168,7 +183,8 @@ GVariant* icl_representation_to_gvariant(iotcon_representation_h repr) GVariantBuilder *repr_gvar = NULL; GVariantBuilder children, resource_types; - RETV_IF(NULL == repr, NULL); + if (NULL == repr) + return _icl_representation_empty_gvariant(); /* uri path */ uri_path = ic_utils_dbus_encode_str(repr->uri_path); diff --git a/lib/icl-response.c b/lib/icl-response.c index 67b3066..4c54da0 100644 --- a/lib/icl-response.c +++ b/lib/icl-response.c @@ -175,7 +175,8 @@ static int _icl_response_check_representation_visibility(iotcon_response_h resp) int ret; RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == resp->repr, IOTCON_ERROR_INVALID_PARAMETER); + if (NULL == resp->repr) + return IOTCON_ERROR_NONE; iotcon_representation_h first = resp->repr; @@ -217,7 +218,6 @@ API int iotcon_response_send(iotcon_response_h resp) RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS); RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == resp->repr, IOTCON_ERROR_INVALID_PARAMETER); ret = _icl_response_check_representation_visibility(resp); if (IOTCON_ERROR_NONE != ret) { |