From: hyunho Date: Fri, 26 Apr 2019 08:12:21 +0000 (+0900) Subject: Fix calling unassigned callback bug X-Git-Tag: submit/tizen/20190426.083438~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd0703f08d7c484fc5c11057663dd7766d649de3;p=platform%2Fcore%2Fapi%2Fnotification.git Fix calling unassigned callback bug Change-Id: I80bb34aa7d9cc04ce65fee6b3f0bed7fd078885a Signed-off-by: hyunho --- diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc index a0ee3cf2..f11b2c10 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> 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 updatedItem) { + if (cb_.updated == nullptr) + return; IEventInfo* c_info = const_cast(&info); cb_.updated(static_cast(manager), static_cast(c_info), @@ -141,6 +145,8 @@ class ManagerCallbackInfo { void InvokeDeleted(Manager* manager, const IEventInfo& info, shared_ptr deletedItem) { + if (cb_.deleted == nullptr) + return; IEventInfo* c_info = const_cast(&info); cb_.deleted(static_cast(manager), static_cast(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(manager), static_cast(error), requestId, user_data_); } @@ -209,6 +217,8 @@ class ReporterCallbackInfo { void InvokeEvent(Reporter* reporter, const IEventInfo& info, list> 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(reporter), static_cast(error), requestId, user_data_); }