Parse json cmd returns as success if nothing in the command json 97/184797/1
authorJeonghoon Park <jh1979.park@samsung.com>
Mon, 23 Jul 2018 07:26:08 +0000 (16:26 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Mon, 23 Jul 2018 07:26:08 +0000 (16:26 +0900)
Change-Id: I3e557471eeae199f42afc8c848edd8b57003b24a

daemon/src/ttd-cmd-mgr.c
daemon/src/ttd-parse-cmd.c

index a4c719c..d2e927e 100644 (file)
@@ -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;
index 6a51ccc..4778e31 100644 (file)
@@ -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++) {