summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhyunho <hhstark.kang@samsung.com>2019-04-26 17:12:21 +0900
committerhyunho <hhstark.kang@samsung.com>2019-04-26 17:12:21 +0900
commitcd0703f08d7c484fc5c11057663dd7766d649de3 (patch)
tree803aedc798dc7d3beefe70eb43573c2501a5733f
parent471b991889c1e276fd45b040ace4ece5cd8afa78 (diff)
downloadnotification-cd0703f08d7c484fc5c11057663dd7766d649de3.tar.gz
notification-cd0703f08d7c484fc5c11057663dd7766d649de3.tar.bz2
notification-cd0703f08d7c484fc5c11057663dd7766d649de3.zip
Fix calling unassigned callback bug
Change-Id: I80bb34aa7d9cc04ce65fee6b3f0bed7fd078885a Signed-off-by: hyunho <hhstark.kang@samsung.com>
-rw-r--r--notification-ex/stub.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc
index a0ee3cf..f11b2c1 100644
--- a/notification-ex/stub.cc
+++ b/notification-ex/stub.cc
@@ -111,6 +111,8 @@ class ManagerCallbackInfo {
void InvokeAdded(Manager* manager, const IEventInfo& info,
list<shared_ptr<AbstractItem>> addedItem) {
+ if (cb_.added == nullptr)
+ return;
noti_ex_item_h* added_item =
(noti_ex_item_h*)calloc(addedItem.size(), sizeof(noti_ex_item_h));
if (added_item == nullptr) {
@@ -133,6 +135,8 @@ class ManagerCallbackInfo {
void InvokeUpdated(Manager* manager, const IEventInfo& info,
shared_ptr<item::AbstractItem> updatedItem) {
+ if (cb_.updated == nullptr)
+ return;
IEventInfo* c_info = const_cast<IEventInfo*>(&info);
cb_.updated(static_cast<noti_ex_manager_h>(manager),
static_cast<noti_ex_event_info_h>(c_info),
@@ -141,6 +145,8 @@ class ManagerCallbackInfo {
void InvokeDeleted(Manager* manager, const IEventInfo& info,
shared_ptr<item::AbstractItem> deletedItem) {
+ if (cb_.deleted == nullptr)
+ return;
IEventInfo* c_info = const_cast<IEventInfo*>(&info);
cb_.deleted(static_cast<noti_ex_manager_h>(manager),
static_cast<noti_ex_event_info_h>(c_info),
@@ -149,6 +155,8 @@ class ManagerCallbackInfo {
}
void InvokeError(Manager* manager, NotificationError error, int requestId) {
+ if (cb_.error == nullptr)
+ return;
cb_.error(static_cast<noti_ex_manager_h>(manager),
static_cast<noti_ex_error_e>(error), requestId, user_data_);
}
@@ -209,6 +217,8 @@ class ReporterCallbackInfo {
void InvokeEvent(Reporter* reporter, const IEventInfo& info,
list<shared_ptr<AbstractItem>> notiList) {
+ if (cb_.event == nullptr)
+ return;
noti_ex_item_h* noti_list =
(noti_ex_item_h*)calloc(notiList.size(), sizeof(noti_ex_item_h));
if (noti_list == nullptr) {
@@ -230,6 +240,8 @@ class ReporterCallbackInfo {
}
void InvokeError(Reporter* reporter, NotificationError error, int requestId) {
+ if (cb_.error == nullptr)
+ return;
cb_.error(static_cast<noti_ex_reporter_h>(reporter),
static_cast<noti_ex_error_e>(error), requestId, user_data_);
}