diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 5b6fc92099..d9fffe44c2 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -217,6 +217,13 @@ _gdk_wayland_display_open (const gchar *display_name) GdkDisplay *display; GdkWaylandDisplay *display_wayland; + /* If this variable is unset then wayland initialisation will surely + * fail, logging a fatal error in the process. Save ourselves from + * that. + */ + if (g_getenv ("XDG_RUNTIME_DIR") == NULL) + return NULL; + wl_log_set_handler_client(log_handler); wl_display = wl_display_connect(display_name);