From 9e5f11554efbc6a8a042ebbe49c936780bba7254 Mon Sep 17 00:00:00 2001 From: Jeonghoon Park Date: Mon, 23 Jul 2018 16:26:08 +0900 Subject: [PATCH 1/1] Parse json cmd returns as success if nothing in the command json Change-Id: I3e557471eeae199f42afc8c848edd8b57003b24a --- daemon/src/ttd-cmd-mgr.c | 5 +++++ daemon/src/ttd-parse-cmd.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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++) { -- 2.7.4