diff options
author | Tobias Markmann <tm@ayena.de> | 2016-02-12 16:09:32 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-02-12 16:09:32 (GMT) |
commit | c3ca881c2f08930c0fd280bc2f41af89986770a8 (patch) | |
tree | cf3f68d979a54264e5d6f4c3cfe037d1bd02e79d | |
parent | d1d2c19154bcd94e1895624bc3a1ac048fe1b569 (diff) | |
download | swift-c3ca881c2f08930c0fd280bc2f41af89986770a8.zip swift-c3ca881c2f08930c0fd280bc2f41af89986770a8.tar.bz2 |
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
-rw-r--r-- | SwifTools/Notifier/NotificationCenterNotifier.mm | 6 |
1 files changed, 4 insertions, 2 deletions
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; |