From 9d64cddb8e8e894cdc68ceb16b980d1294b39142 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 3 Jan 2017 11:39:25 +0900 Subject: [PATCH] Add null checker for vc handle Change-Id: I35c95b0f1dbcdc9a77943d495fa8d7c434ef9d34 Signed-off-by: sooyeon.kim (cherry picked from commit 56d901b6741cf34b6dec4cba51d9b8020106f829) --- client/vc_widget.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/client/vc_widget.c b/client/vc_widget.c index 3989c99..3143799 100644 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -1240,6 +1240,11 @@ static Eina_Bool __vc_widget_notify_state_changed(void *data) int vc_widget_set_result_cb(vc_h vc_w, vc_result_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1262,6 +1267,11 @@ int vc_widget_set_result_cb(vc_h vc_w, vc_result_cb callback, void* user_data) int vc_widget_unset_result_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1282,6 +1292,11 @@ int vc_widget_unset_result_cb(vc_h vc_w) int vc_widget_set_show_tooltip_cb(vc_h vc_w, vc_widget_show_tooltip_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1305,6 +1320,11 @@ int vc_widget_set_show_tooltip_cb(vc_h vc_w, vc_widget_show_tooltip_cb callback, int vc_widget_unset_show_tooltip_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1325,6 +1345,11 @@ int vc_widget_unset_show_tooltip_cb(vc_h vc_w) int vc_widget_set_send_current_command_list_cb(vc_h vc_w, vc_widget_send_current_command_list_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1345,6 +1370,11 @@ int vc_widget_set_send_current_command_list_cb(vc_h vc_w, vc_widget_send_current int vc_widget_unset_send_current_command_list_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1411,6 +1441,11 @@ int __vc_widget_cb_service_state(int state) int vc_widget_set_service_state_changed_cb(vc_h vc_w, vc_service_state_changed_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1431,6 +1466,11 @@ int vc_widget_set_service_state_changed_cb(vc_h vc_w, vc_service_state_changed_c int vc_widget_unset_service_state_changed_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1451,6 +1491,11 @@ int vc_widget_unset_service_state_changed_cb(vc_h vc_w) int vc_widget_set_state_changed_cb(vc_h vc_w, vc_state_changed_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1474,6 +1519,11 @@ int vc_widget_set_state_changed_cb(vc_h vc_w, vc_state_changed_cb callback, void int vc_widget_unset_state_changed_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1494,6 +1544,11 @@ int vc_widget_unset_state_changed_cb(vc_h vc_w) int vc_widget_set_asr_result_cb(vc_h vc_w, vc_asr_result_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1517,6 +1572,11 @@ int vc_widget_set_asr_result_cb(vc_h vc_w, vc_asr_result_cb callback, void* user int vc_widget_unset_asr_result_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1537,6 +1597,11 @@ int vc_widget_unset_asr_result_cb(vc_h vc_w) int vc_widget_set_current_language_changed_cb(vc_h vc_w, vc_current_language_changed_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1560,6 +1625,11 @@ int vc_widget_set_current_language_changed_cb(vc_h vc_w, vc_current_language_cha int vc_widget_unset_current_language_changed_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { @@ -1580,6 +1650,11 @@ int vc_widget_unset_current_language_changed_cb(vc_h vc_w) int vc_widget_set_error_cb(vc_h vc_w, vc_error_cb callback, void* user_data) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1603,6 +1678,11 @@ int vc_widget_set_error_cb(vc_h vc_w, vc_error_cb callback, void* user_data) int vc_widget_unset_error_cb(vc_h vc_w) { + if (NULL == vc_w) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCW, "[CHECK] uid (%d)", vc_w->handle); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { -- 2.7.4