Fix: missing check_command attribute results in sigsegv on check execution

Fixes #4331
This commit is contained in:
Gunnar Beutner 2013-06-24 09:30:49 +02:00
parent 2b1c268ecd
commit b0ac607caf
2 changed files with 9 additions and 2 deletions

View File

@ -50,6 +50,8 @@ type Host {
%attribute string "*"
},
%attribute name(CheckCommand) "check_command",
%attribute name(TimePeriod) "check_period",
%attribute number "check_interval",
%attribute number "retry_interval",
@ -331,4 +333,4 @@ type NotificationCommand inherits Command {
type EventCommand inherits Command {
}
}

View File

@ -582,7 +582,12 @@ void Service::ExecuteCheck(void)
Dictionary::Ptr result;
try {
result = GetCheckCommand()->Execute(GetSelf());
CheckCommand::Ptr command = GetCheckCommand();
if (!command)
return;
result = command->Execute(GetSelf());
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
msgbuf << "Exception occured during check for service '"