From 67cf8daa6d43205c3b6ecc98da8e10c196c741bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 2 Apr 2011 10:31:39 +0200
Subject: Do not crash when clicking system message notifications.

Resolves: #818

diff --git a/SwifTools/Notifier/GrowlNotifier.cpp b/SwifTools/Notifier/GrowlNotifier.cpp
index 5ecd34c..e289313 100644
--- a/SwifTools/Notifier/GrowlNotifier.cpp
+++ b/SwifTools/Notifier/GrowlNotifier.cpp
@@ -31,7 +31,7 @@ namespace {
 		assert(CFDataGetLength(growlContextData) == sizeof(Context));
 		CFDataGetBytes(growlContextData, CFRangeMake(0, CFDataGetLength(growlContextData)), (UInt8*) &context);
 		
-		if (activateCallback) {
+		if (activateCallback && !context.callback->empty()) {
 			(*context.callback)();
 		}
 		delete context.callback;
diff --git a/SwifTools/Notifier/SnarlNotifier.cpp b/SwifTools/Notifier/SnarlNotifier.cpp
index e93a539..d891e7d 100644
--- a/SwifTools/Notifier/SnarlNotifier.cpp
+++ b/SwifTools/Notifier/SnarlNotifier.cpp
@@ -58,7 +58,7 @@ void SnarlNotifier::handleMessageReceived(MSG* message) {
 			int notificationID = message->lParam;
 			NotificationsMap::iterator i = notifications.find(notificationID);
 			if (i != notifications.end()) {
-				if (action == Snarl::V41::SnarlEnums::NotificationAck) {
+				if (action == Snarl::V41::SnarlEnums::NotificationAck && !i->second.empty()) {
 					i->second();
 				}
 				notifications.erase(i);
-- 
cgit v0.10.2-6-g49f6