From c3ca881c2f08930c0fd280bc2f41af89986770a8 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Fri, 12 Feb 2016 17:09:32 +0100 Subject: Fix bug in OS X Notification Center backend on empty callback Checked Growl and Snarl backends which both already do the check for empty callbacks. Test-Information: Tested clicking on an disconnect notification of Swift on OS X 10.11.3 which previously caused a crash. Now it does not crash anymore in this case. Change-Id: I7045ab22a0322cc7a50761640a9b89ba2302acef diff --git a/SwifTools/Notifier/NotificationCenterNotifier.mm b/SwifTools/Notifier/NotificationCenterNotifier.mm index 74d814e..10319c8 100644 --- a/SwifTools/Notifier/NotificationCenterNotifier.mm +++ b/SwifTools/Notifier/NotificationCenterNotifier.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -84,7 +84,9 @@ void NotificationCenterNotifier::purgeCallbacks() { void NotificationCenterNotifier::handleUserNotificationActivated(const std::string& identifier) { if (p->callbacksForNotifications.find(identifier) != p->callbacksForNotifications.end()) { - (*p->callbacksForNotifications[identifier]->callback)(); + if (!(*p->callbacksForNotifications[identifier]->callback).empty()) { + (*p->callbacksForNotifications[identifier]->callback)(); + } } else { SWIFT_LOG(warning) << "Missing callback entry for activated notification. The activate notification may come from another instance." << std::endl; -- cgit v0.10.2-6-g49f6