launch_daemon: Fixed NULL events.
* Also, events now can actually be NULL when there is an empty "on" field in the settings. * This fixes a crash, too.
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
BaseJob::BaseJob(const char* name)
|
||||
:
|
||||
BJob(name),
|
||||
fCondition(NULL)
|
||||
fCondition(NULL),
|
||||
fEvent(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -87,7 +88,8 @@ void
|
||||
BaseJob::SetEvent(::Event* event)
|
||||
{
|
||||
fEvent = event;
|
||||
event->SetOwner(this);
|
||||
if (event != NULL)
|
||||
event->SetOwner(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,8 +92,12 @@ static Event*
|
||||
create_event(Event* parent, const char* name, const BMessenger* target,
|
||||
const BMessage& args)
|
||||
{
|
||||
if (strcmp(name, "or") == 0)
|
||||
if (strcmp(name, "or") == 0) {
|
||||
if (args.IsEmpty())
|
||||
return NULL;
|
||||
|
||||
return new OrEvent(parent, target, args);
|
||||
}
|
||||
|
||||
if (strcmp(name, "demand") == 0)
|
||||
return new DemandEvent(parent);
|
||||
@@ -356,6 +360,7 @@ FileCreatedEvent::FileCreatedEvent(Event* parent, const BMessage& args)
|
||||
status_t
|
||||
FileCreatedEvent::Register(EventRegistrator& registrator) const
|
||||
{
|
||||
// TODO: implement!
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user