1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
From: Ondrej Holy <oholy@redhat.com>
Date: Fri, 24 Aug 2018 14:30:14 +0200
Subject: Return empty string instead of NULL to prevent criticals
The code expects that avahi_client_get_host_name_fqdn never return NULL,
but it can happen in some cases. Return empty string instead of NULL to
prevent the following criticals:
GLib-CRITICAL **: 14:29:52.305: g_variant_new_string: assertion 'string != NULL' failed
https://bugzilla.gnome.org/show_bug.cgi?id=796349
---
server/vino-mdns.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/server/vino-mdns.c b/server/vino-mdns.c
index 4f7e693..6a16b64 100644
--- a/server/vino-mdns.c
+++ b/server/vino-mdns.c
@@ -356,7 +356,12 @@ vino_mdns_shutdown (void)
const char *
vino_mdns_get_hostname (void)
{
- return mdns_client ? avahi_client_get_host_name_fqdn (mdns_client) : "";
+ const char *hostname = NULL;
+
+ if (mdns_client)
+ hostname = avahi_client_get_host_name_fqdn (mdns_client);
+
+ return hostname ? hostname : "";
}
#else /* !defined (VINO_HAVE_AVAHI) */
|