diff --git a/src/switch_ivr.c b/src/switch_ivr.c index c4ef5f3ffb..8b9e445a47 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -572,7 +572,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s } while (switch_channel_ready(channel)) { - switch_frame_t *read_frame; + switch_frame_t *read_frame = NULL; switch_event_t *event; switch_dtmf_t dtmf = {0}; @@ -617,7 +617,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s break; } - if (args && (args->read_frame_callback)) { + if (read_frame && args && (args->read_frame_callback)) { if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { break; }