summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-07-25 21:23:19 +0300
committerTor Lillqvist <tml@iki.fi>2013-07-25 21:26:37 +0300
commita7be6a2e89960e753c4ea1d58ded61a99f028fa8 (patch)
tree00b9d95409771c0651e6009016f43f466668f0c9
parentf40461a223c5c289aba37daf70b4613af8134409 (diff)
Don't use zService if not set
Change-Id: I1043ab54cbffddd316d141e3f5d368849e3070ca
-rw-r--r--sd/source/ui/remotecontrol/DiscoveryService.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 1b2db7747b10..62c3e6e2aaf9 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -53,22 +53,24 @@ using namespace sd;
DiscoveryService::DiscoveryService()
{
+ zService = NULL;
+
#ifdef MACOSX
// Bonjour for OSX
zService = new OSXNetworkService();
#endif
-#ifdef LINUX
- #ifdef ENABLE_AVAHI
+
+#ifdef ENABLE_AVAHI
// Avahi for Linux
char hostname[1024];
hostname[1023] = '\0';
gethostname(hostname, 1023);
zService = new AvahiNetworkService(hostname);
- #endif
#endif
- zService->setup();
+ if (zService)
+ zService->setup();
// Old implementation for backward compatibility matter
mSocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
@@ -113,7 +115,8 @@ DiscoveryService::~DiscoveryService()
close( mSocket );
#endif
- zService->clear();
+ if (zService)
+ zService->clear();
}
void SAL_CALL DiscoveryService::run()