summaryrefslogtreecommitdiff
path: root/nonsystemd/libportal/fix-epiphany-nonsystemd-crash.patch
blob: 11af06e1d23629b60e6a655cf78cbc36b4039492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fetched from upstream BR:
https://gitlab.gnome.org/GNOME/epiphany/-/issues/1856

--- a/libportal/portal.c  2022-09-18 20:56:10.062136394 +0100
+++ b/libportal/portal.c  2022-09-18 20:59:44.879138215 +0100
@@ -258,9 +258,13 @@
 xdp_portal_init (XdpPortal *portal)
 {
   int i;
+  const gchar *dbus_connection_name;

   portal->bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
-  portal->sender = g_strdup (g_dbus_connection_get_unique_name (portal->bus) + 1);
+  dbus_connection_name = portal->bus ? g_dbus_connection_get_unique_name (portal->bus) : NULL;
+  if (!dbus_connection_name)
+    dbus_connection_name = "_DBUS_NOT_PRESENT";
+  portal->sender = g_strdup (dbus_connection_name + 1);
   for (i = 0; portal->sender[i]; i++)
     if (portal->sender[i] == '.')
       portal->sender[i] = '_';