Skip to content

Commit 2a1c378

Browse files
committed
Fix segmentation fault if contact has no mail or alias
1 parent ae7754f commit 2a1c378

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/statusengine.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ int nebmodule_init(int flags, char *args, nebmodule *handle){
270270
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_TITLE, "Statusengine - the missing event broker");
271271
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_AUTHOR, "Daniel Ziegler");
272272
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_TITLE, "Copyright (c) 2014 - present Daniel Ziegler");
273-
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.0");
273+
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_VERSION, "3.0.1");
274274
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_LICENSE, "GPL v2");
275275
neb_set_module_info(statusengine_module_handle, NEBMODULE_MODINFO_DESC, "A powerful and flexible event broker");
276276

@@ -1658,8 +1658,8 @@ void dump_object_data(){
16581658
my_object = json_object_new_object();
16591659
json_object_object_add(my_object, "object_type", json_object_new_int(10));
16601660
json_object_object_add(my_object, "name", json_object_new_string(temp_contact->name));
1661-
json_object_object_add(my_object, "alias", json_object_new_string(temp_contact->alias));
1662-
json_object_object_add(my_object, "email", json_object_new_string(temp_contact->email));
1661+
json_object_object_add(my_object, "alias", (temp_contact->alias != NULL ? json_object_new_string(temp_contact->alias) : NULL));
1662+
json_object_object_add(my_object, "email", (temp_contact->email != NULL ? json_object_new_string(temp_contact->email) : NULL));
16631663
json_object_object_add(my_object, "pager", (temp_contact->pager != NULL ? json_object_new_string(temp_contact->pager) : NULL));
16641664
json_object_object_add(my_object, "host_notification_period", json_object_new_string(temp_contact->host_notification_period));
16651665
json_object_object_add(my_object, "service_notification_period", json_object_new_string(temp_contact->service_notification_period));
@@ -2185,3 +2185,4 @@ void dump_object_data(){
21852185
json_object_put(my_object);
21862186

21872187
}
2188+

0 commit comments

Comments
 (0)