[gnote/gnome-3-16] Fix crash when DESKTOP_SESSION env variable is not set



commit 76db3d8ef103d29ca253a3f3b99dc77dcd8223fa
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Jul 6 22:30:57 2015 +0300

    Fix crash when DESKTOP_SESSION env variable is not set
    
    Fixes Bug 752024.

 src/mainwindow.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 9dd0d13..22bff57 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -104,7 +104,8 @@ MainWindow *MainWindow::present_default(const Note::Ptr & note)
 bool MainWindow::use_client_side_decorations()
 {
   if (s_use_client_side_decorations < 0) {
-    if(std::strcmp(std::getenv("DESKTOP_SESSION"), "gnome") == 0) {
+    const char *desktop_session = std::getenv("DESKTOP_SESSION");
+    if(desktop_session && std::strcmp(desktop_session, "gnome") == 0) {
       s_use_client_side_decorations = 1;
     }
     else {


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