diff options
author | mk5004.lee <mk5004.lee@samsung.com> | 2018-09-04 19:05:59 +0900 |
---|---|---|
committer | mk5004.lee <mk5004.lee@samsung.com> | 2018-09-04 19:15:34 +0900 |
commit | 14f1aa8c8df4632937c1b2e05be0ba6fc4a7c68d (patch) | |
tree | 0563d9d7227e1e90ea13f00321c19d2dd682327d | |
parent | eb2825858e4459e64c72c63fafd01f9e3b81c3e7 (diff) | |
download | badge-14f1aa8c8df4632937c1b2e05be0ba6fc4a7c68d.tar.gz badge-14f1aa8c8df4632937c1b2e05be0ba6fc4a7c68d.tar.bz2 badge-14f1aa8c8df4632937c1b2e05be0ba6fc4a7c68d.zip |
Check result for field data
- If the result is Fail, do not execute the condition statement
Change-Id: I26a0fb199585ac44c87822bc8187a780fb7dae4f
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rwxr-xr-x | src/badge_setting_service.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/badge_setting_service.c b/src/badge_setting_service.c index 587f80e..ee3a382 100755 --- a/src/badge_setting_service.c +++ b/src/badge_setting_service.c @@ -112,7 +112,7 @@ EXPORT_API int badge_db_get_setting_by_appid(const char *appid, badge_setting_h char **query_result = NULL; badge_setting_h result_setting; sqlite3 *db = NULL; - int atd = 0; + int atd; if (appid == NULL) return BADGE_ERROR_INVALID_PARAMETER; @@ -168,14 +168,16 @@ EXPORT_API int badge_db_get_setting_by_appid(const char *appid, badge_setting_h _get_table_field_data_string(query_result, &(result_setting[0].pkgname), 1, col_index++); _get_table_field_data_string(query_result, &(result_setting[0].appid), 1, col_index++); - _get_table_field_data_int(query_result, &atd, col_index++); - - if (atd & BAGDE_APP_DISABLE_BIT) - result_setting[0].allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; - else if (atd & BAGDE_ALLOW_TO_DISPLAY_BIT) - result_setting[0].allow_to_display = BAGDE_ALLOW_TO_DISPLAY; - else + if (_get_table_field_data_int(query_result, &atd, col_index++)) { + if (atd & BAGDE_APP_DISABLE_BIT) + result_setting[0].allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + else if (atd & BAGDE_ALLOW_TO_DISPLAY_BIT) + result_setting[0].allow_to_display = BAGDE_ALLOW_TO_DISPLAY; + else + result_setting[0].allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + } else { result_setting[0].allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + } *setting = result_setting; @@ -254,7 +256,7 @@ EXPORT_API int badge_db_get_allow_to_display_by_appid(char *appid, int *allow_to char *sql_query = NULL; char **query_result = NULL; sqlite3 *db = NULL; - int atd = 0; + int atd; if (appid == NULL) return BADGE_ERROR_INVALID_PARAMETER; @@ -299,14 +301,16 @@ EXPORT_API int badge_db_get_allow_to_display_by_appid(char *appid, int *allow_to col_index = col_count; - _get_table_field_data_int(query_result, &atd, col_index++); - - if (atd & BAGDE_APP_DISABLE_BIT) - *allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; - else if (atd & BAGDE_ALLOW_TO_DISPLAY_BIT) - *allow_to_display = BAGDE_ALLOW_TO_DISPLAY; - else + if (_get_table_field_data_int(query_result, &atd, col_index++)) { + if (atd & BAGDE_APP_DISABLE_BIT) + *allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + else if (atd & BAGDE_ALLOW_TO_DISPLAY_BIT) + *allow_to_display = BAGDE_ALLOW_TO_DISPLAY; + else + *allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + } else { *allow_to_display = BAGDE_NOT_ALLOW_TO_DISPLAY; + } out: if (query_result) |