From e1aa9b11ca429e34dd847fff2f80f6fe550104f4 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 26 Aug 2015 17:06:28 -0500 Subject: [PATCH] FS-8056: [mod_voicemail] fix segfault on vm_inject, regression from FS-7968 --- src/mod/applications/mod_voicemail/mod_voicemail.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 418e522e46..9ccb898b49 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2730,7 +2730,11 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_status_t ret = SWITCH_STATUS_SUCCESS; char *convert_cmd = profile->convert_cmd; char *convert_ext = profile->convert_ext; - switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_t *channel = NULL; + + if (session) { + channel = switch_core_session_get_channel(session); + } if (!params) { switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS); @@ -2883,7 +2887,9 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-UUID", use_uuid); switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Message-Len", "%u", message_len); switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_epoch_time_now(NULL)); - switch_channel_event_set_data(channel, message_event); + if (channel) { + switch_channel_event_set_data(channel, message_event); + } switch_event_fire(&message_event);