[epiphany] Do not crash when XDG_CURRENT_DESKTOP is undefined in the environment



commit 1fecd5cd6df631b94a7a44d81fe1588e969fd6a4
Author: Adrian Perez de Castro <aperez igalia com>
Date:   Wed Jan 23 01:21:42 2019 +0200

    Do not crash when XDG_CURRENT_DESKTOP is undefined in the environment
    
    The is_desktop_pantheon() function checks the XDG_CURRENT_DESKTOP
    environment variable. Add a NULL-check in it to avoid crashing when the
    variable is not defined, which is the case with a number of DEs, plain
    window managers, and standalone Wayland compositors.

 src/ephy-header-bar.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index cd119088c..1df3a72df 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -140,6 +140,9 @@ is_desktop_pantheon (void)
 {
   const gchar *xdg_current_desktop = g_environ_getenv (g_get_environ (), "XDG_CURRENT_DESKTOP");
 
+  if (!xdg_current_desktop)
+      return FALSE;
+
   return strstr (xdg_current_desktop, "Pantheon") != NULL;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]