From 80e4ddb274f1b6093f929eb15177f501b05f7672 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)> Date: Wed, 2 Dec 2009 18:10:25 -0500 Subject: [PATCH] [#2543] Fix SFLphone startup failure due to empty dns server array --- sflphone-common/src/sip/sipvoiplink.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 2acd4ca5ff..a712ae4636 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -1644,13 +1644,16 @@ pj_status_t SIPVoIPLink::enable_dns_srv_resolver (pjsip_endpoint *endpt, pj_dns_ } if (!get_dns_server_addresses (&dns_servers)) { - _debug ("Error while fetching DNS information\n"); + _debug ("Error while fetching DNS information\n"); return -1; } // Build the nameservers list needed by pjsip - scount = dns_servers.size (); - + if ((scount = dns_servers.size ()) <= 0) { + _debug("No server detected while fetching DNS information, stop dns resolution\n"); + return 0; + } + pj_str_t nameservers[scount]; for (i = 0; i<scount; i++) { @@ -1967,8 +1970,8 @@ int SIPVoIPLink::createUDPServer (AccountID id) } else { // We are trying to initialize a UDP transport available for all local accounts and direct IP calls if (account->getLocalAddress () != "0.0.0.0") { - listeningAddress = account->getLocalAddress (); - } + listeningAddress = account->getLocalAddress (); + } listeningPort = account->getLocalPort (); } @@ -2029,8 +2032,9 @@ int SIPVoIPLink::createUDPServer (AccountID id) if (account == NULL) _localUDPTransport = transport; - else - account->setAccountTransport (transport); + else { + account->setAccountTransport (transport); + } } _debug ("Transport initialized successfully on %s:%i\n", listeningAddress.c_str (), listeningPort); -- GitLab