From bc66d7131824c504ebdc0b7c753494b3e5034358 Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Tue, 30 Aug 2016 09:52:55 +0900 Subject: [PATCH] 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 --- src/notification_ipc.c | 3 +++ src/notification_noti.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) 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); -- 2.7.4