From 1cd3c746a1d3b8d0a5eeb100ea582ff04cc4a454 Mon Sep 17 00:00:00 2001 From: methodus Date: Wed, 2 Jan 2013 21:26:22 +0100 Subject: Fixed crash if no network connection is available. Plugin will then listen on localhost --- server/server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/server.cpp b/server/server.cpp index 2bac18a..f8c5515 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -180,7 +180,7 @@ bool cMediaServer::Initialize(){ ? mCurrentConfiguration.address : tools::GetAddressByInterface(mCurrentConfiguration.interface); - if(address.empty() || !address.compare("0.0.0.0")){ + if(address.empty() || address.compare("0.0.0.0") == 0){ address = tools::GetAddressByInterface(tools::GetNetworkInterfaceByIndex(0, true)); } @@ -192,9 +192,9 @@ bool cMediaServer::Initialize(){ int ret = 0; - LOG(1, "Initializing UPnP media server on %s:%d", address.c_str(), port); + LOG(1, "Initializing UPnP media server on %s:%d", address.empty()?"0":address.c_str(), port); - ret = UpnpInit(address.c_str(), mCurrentConfiguration.port); + ret = UpnpInit(address.empty()?"127.0.0.1":address.c_str(), mCurrentConfiguration.port); if(ret != UPNP_E_SUCCESS && ret != UPNP_E_INIT){ esyslog("UPnP\tFailed to initialise UPnP media server. Error code: %d", ret); -- cgit v1.2.3