From 91e0566de03654f82dd805cb2f98c4d2a36dfef1 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 24 Sep 2013 18:58:51 +0200 Subject: [PATCH] Fix crash on missing notification_command. --- lib/icinga/notification.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 7b4ec5d68..8828c1cf8 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -337,12 +337,14 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User:: } try { - NotificationCommand::Ptr notificationCommand = GetNotificationCommand(); + NotificationCommand::Ptr command = GetNotificationCommand(); - if (!notificationCommand) - BOOST_THROW_EXCEPTION(std::invalid_argument("Notification command for notification object '" + GetName() + " and user '" + user->GetName() + "' does not exist.")); + if (!command) { + Log(LogDebug, "icinga", "No notification_command found for notification '" + GetName() + "'. Skipping execution."); + return; + } - GetNotificationCommand()->Execute(GetSelf(), user, cr, type); + command->Execute(GetSelf(), user, cr, type); { ObjectLock olock(this);