From: Jeonghoon Park Date: Mon, 23 Jul 2018 07:26:08 +0000 (+0900) Subject: Parse json cmd returns as success if nothing in the command json X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e5f11554efbc6a8a042ebbe49c936780bba7254;hp=6614ee1a512bc4916fa7dfe30358b7b2b04d1125;p=apps%2Fnative%2Ftizen-things-daemon.git Parse json cmd returns as success if nothing in the command json Change-Id: I3e557471eeae199f42afc8c848edd8b57003b24a --- diff --git a/daemon/src/ttd-cmd-mgr.c b/daemon/src/ttd-cmd-mgr.c index a4c719c..d2e927e 100644 --- a/daemon/src/ttd-cmd-mgr.c +++ b/daemon/src/ttd-cmd-mgr.c @@ -166,6 +166,11 @@ static int _get_cloud_cmd(struct __cmd_mgr_h *handle, long *res_code) g_free(cmd); cmd = NULL; + if (!cmd_list) { + _D("Thers is no command now"); + return 0; + } + for (l = cmd_list; l != NULL; l = l->next) { ttd_cmd_data *cmd_data = NULL; ttd_cmd_data *item = NULL; diff --git a/daemon/src/ttd-parse-cmd.c b/daemon/src/ttd-parse-cmd.c index 6a51ccc..4778e31 100644 --- a/daemon/src/ttd-parse-cmd.c +++ b/daemon/src/ttd-parse-cmd.c @@ -263,9 +263,9 @@ int ttd_parse_json_to_cmd(const char *json_str, GList **cmd_list) cmd_length = json_object_array_length(items_obj); if (cmd_length <= 0) { - _E("Nothing in the cmd array"); + _W("Nothing in the cmd array"); json_object_put(root_obj); - return -1; + return 0; } for (i = 0; i < cmd_length; i++) {