From 308cde355a384d9a5bd8dc19ef4e80d9b24fdf24 Mon Sep 17 00:00:00 2001 From: youngman Date: Mon, 18 Jan 2016 15:30:03 +0900 Subject: [PATCH] modify iotcon_representation_get_children_count() Change-Id: Ia4d4d41161fa245ee977a6a5e7b8b0902ef34abc Signed-off-by: youngman --- lib/icl-representation.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/icl-representation.c b/lib/icl-representation.c index aadaeba..26ddddd 100644 --- a/lib/icl-representation.c +++ b/lib/icl-representation.c @@ -250,9 +250,10 @@ API int iotcon_representation_get_children_count(iotcon_representation_h parent, { RETV_IF(NULL == parent, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == count, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == parent->children, IOTCON_ERROR_INVALID_PARAMETER); - - *count = g_list_length(parent->children); + if (NULL == parent->children) + *count = 0; + else + *count = g_list_length(parent->children); return IOTCON_ERROR_NONE; } -- 2.34.1