Add error handling code when row_count is zero 41/94741/3 accepted/tizen/3.0/ivi/20161102.075724 accepted/tizen/3.0/mobile/20161102.075511 accepted/tizen/3.0/tv/20161102.075622 accepted/tizen/3.0/wearable/20161102.075653 accepted/tizen/common/20161102.121412 accepted/tizen/ivi/20161101.123005 accepted/tizen/mobile/20161101.122844 accepted/tizen/tv/20161101.122923 accepted/tizen/wearable/20161101.122946 submit/tizen/20161101.004208 submit/tizen_3.0/20161102.051512
authorseungha.son <seungha.son@samsung.com>
Tue, 1 Nov 2016 04:40:37 +0000 (13:40 +0900)
committerseungha.son <seungha.son@samsung.com>
Tue, 1 Nov 2016 05:31:39 +0000 (14:31 +0900)
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: If4f6a2f6acb841e84c1d489b22118e0043382ecb

src/notification_setting_service.c

index a4a3b50..e9adcc3 100644 (file)
@@ -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++);