Add defence code when widget command is not registered 97/109997/1
authorWonnam Jang <wn.jang@samsung.com>
Mon, 2 Jan 2017 09:49:02 +0000 (18:49 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 12 Jan 2017 10:54:12 +0000 (02:54 -0800)
Change-Id: Iebb921fc11044f46b0075d90c9da200c106ff539
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
(cherry picked from commit 69e68b702425f2d1f74151d107c1d43623bd4606)

client/vc_widget.c

index 3989c99..9d3f835 100644 (file)
@@ -1007,6 +1007,11 @@ static Eina_Bool __vc_widget_start_recording(void *data)
                                if (NULL != vc_cmd_list) {
                                        vc_cmd_list_s* list = NULL;
                                        list = (vc_cmd_list_s*)vc_cmd_list;
+                                       if (NULL == list || NULL == list->list) {
+                                               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] No registered commands from send_command_list_cb");
+                                               break;
+                                       }
+
                                        ret = vc_cmd_parser_save_file(getpid(), VC_COMMAND_TYPE_WIDGET, list->list, NULL);
                                        if (0 == ret) {
                                                /* widget command is valid */
@@ -1023,7 +1028,10 @@ static Eina_Bool __vc_widget_start_recording(void *data)
                }
        }
 
-       SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] command list (%d)", g_slist_length(((vc_cmd_list_s*)vc_cmd_list)->list));
+       if (NULL != vc_cmd_list)
+               SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] command list (%d)", g_slist_length(((vc_cmd_list_s*)vc_cmd_list)->list));
+       else
+               SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] command list (NULL)");
 
        ret = -1;
        count = 0;
@@ -1048,6 +1056,7 @@ static Eina_Bool __vc_widget_start_recording(void *data)
        return EINA_FALSE;
 }
 
+
 static Eina_Bool __vc_widget_notify_tooltip(void *data)
 {
        bool show = (bool)data;