From: seungha.son Date: Tue, 1 Nov 2016 04:40:37 +0000 (+0900) Subject: Add error handling code when row_count is zero X-Git-Tag: accepted/tizen/3.0/ivi/20161102.075724^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F94741%2F3;p=platform%2Fcore%2Fapi%2Fnotification.git Add error handling code when row_count is zero Signed-off-by: seungha.son Change-Id: If4f6a2f6acb841e84c1d489b22118e0043382ecb --- diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index a4a3b50..e9adcc3 100644 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -632,6 +632,11 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname, ret = NOTIFICATION_ERROR_FROM_DB; goto out; } + if (row_count == 0) { + NOTIFICATION_ERR("Invalid uid [%d] or package name [%s]", uid, pkgname); + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; + } col_index = col_count; _get_table_field_data_int(query_setting_result, (int *)allow_to_notify, col_index++); @@ -643,6 +648,11 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname, ret = NOTIFICATION_ERROR_FROM_DB; goto out; } + if (row_count == 0) { + NOTIFICATION_ERR("Invalid uid [%d]", uid); + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; + } col_index = col_count; _get_table_field_data_int(query_system_setting_result, (int *)do_not_disturb, col_index++);