- ms_mutex_lock(&lupnp->mutex);
-
- if(lupnp->sip_udp != NULL) {
- if(lupnp->sip_udp->state == LinphoneUpnpStateOk) {
- port = lupnp->sip_udp->external_port;
- }
- } else if(lupnp->sip_tcp != NULL) {
- if(lupnp->sip_tcp->state == LinphoneUpnpStateOk) {
- port = lupnp->sip_tcp->external_port;
- }
- } else if(lupnp->sip_tls != NULL) {
- if(lupnp->sip_tls->state == LinphoneUpnpStateOk) {
- port = lupnp->sip_tls->external_port;
+ if(lupnp != NULL) {
+ ms_mutex_lock(&lupnp->mutex);
+
+ if(lupnp->sip_udp != NULL) {
+ if(lupnp->sip_udp->state == LinphoneUpnpStateOk) {
+ port = lupnp->sip_udp->external_port;
+ }
+ } else if(lupnp->sip_tcp != NULL) {
+ if(lupnp->sip_tcp->state == LinphoneUpnpStateOk) {
+ port = lupnp->sip_tcp->external_port;
+ }
+ } else if(lupnp->sip_tls != NULL) {
+ if(lupnp->sip_tls->state == LinphoneUpnpStateOk) {
+ port = lupnp->sip_tls->external_port;
+ }