From 693461bc427ccc0982b7249a357b9d9673e8cdbc Mon Sep 17 00:00:00 2001 From: Amilcar Ubiera Date: Tue, 16 Jan 2024 22:14:31 -0500 Subject: [PATCH] pjsua_handle_ip_change: Added missing null check for on_ip_changed_progress callback --- pjsip/src/pjsua-lib/pjsua_core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 85088d98b4..76fc296f13 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -3985,7 +3985,6 @@ PJ_DEF(pj_status_t) pjsua_handle_ip_change(const pjsua_ip_change_param *param) /* Shutdown all TCP/TLS transports */ if (param->shutdown_transport) { pjsip_tpmgr_shutdown_param param; - pjsua_ip_change_op_info info; pjsip_tpmgr_shutdown_param_default(¶m); param.include_udp = PJ_FALSE; @@ -3998,10 +3997,14 @@ PJ_DEF(pj_status_t) pjsua_handle_ip_change(const pjsua_ip_change_param *param) /* Provide dummy info instead of NULL info to avoid possible crash * (if app does not check). */ - pj_bzero(&info, sizeof(info)); - pjsua_var.ua_cfg.cb.on_ip_change_progress( - PJSUA_IP_CHANGE_OP_SHUTDOWN_TP, - status, &info); + if (pjsua_var.ua_cfg.cb.on_ip_change_progress) { + pjsua_ip_change_op_info info; + + pj_bzero(&info, sizeof(info)); + pjsua_var.ua_cfg.cb.on_ip_change_progress( + PJSUA_IP_CHANGE_OP_SHUTDOWN_TP, + status, &info); + } } if (param->restart_listener) {