From: Myungki Lee Date: Tue, 30 Aug 2016 00:52:55 +0000 (+0900) Subject: Add exception in case pkgname is null X-Git-Tag: accepted/tizen/common/20160905.171403~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc66d7131824c504ebdc0b7c753494b3e5034358;p=platform%2Fcore%2Fapi%2Fnotification.git Add exception in case pkgname is null - GLib-CRITICAL **: g_variant_new_string: assertion 'string != NULL' failed Change-Id: I65a99c0c3031abd9dc9477adc78b0ba02d681d06 Signed-off-by: Myungki Lee --- diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 3fbb1d3..be7b43c 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -863,6 +863,9 @@ int notification_ipc_request_delete_single(notification_type_e type, char *pkgna return result; } + if (!pkgname) + pkgname = ""; + body = g_variant_new("(sii)", pkgname, priv_id, uid); result = _send_sync_noti(body, &reply, "del_noti_single"); diff --git a/src/notification_noti.c b/src/notification_noti.c index e413268..114b893 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -1367,17 +1367,18 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna char query[NOTIFICATION_QUERY_MAX] = {0, }; int ret; - if (pkgname == NULL || strlen(pkgname) == 0) - return NOTIFICATION_ERROR_INVALID_PARAMETER; - db = notification_db_open(DBPATH); if (!db) return get_last_result(); - snprintf(query, sizeof(query), "delete from noti_list " - "where caller_pkgname = '%s' and priv_id = %d and uid = %d", pkgname, - priv_id, uid); - NOTIFICATION_DBG("%s", query); + if (pkgname == NULL || strlen(pkgname) == 0) { + snprintf(query, sizeof(query), "delete from noti_list " + "where priv_id = %d and uid = %d", priv_id, uid); + } else { + snprintf(query, sizeof(query), "delete from noti_list " + "where caller_pkgname = '%s' and priv_id = %d and uid = %d", + pkgname, priv_id, uid); + } ret = notification_db_exec(db, query, num_changes);