From 2915630b5fbef884044bf376e15fe9cb6b0f0c7d Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Tue, 1 Nov 2016 13:40:37 +0900 Subject: [PATCH] Add error handling code when row_count is zero Signed-off-by: seungha.son Change-Id: If4f6a2f6acb841e84c1d489b22118e0043382ecb --- src/notification_setting_service.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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++); -- 2.7.4