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: submit/tizen/20161101.004208^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2915630b5fbef884044bf376e15fe9cb6b0f0c7d;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 a4a3b508..e9adcc37 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++);