[gnome-shell] loginManager: Handle unset XDG_SESSION_ID more gracefully



commit de4c0bdca656bce9ef47155ef35f733834e1e43e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Nov 5 14:49:23 2015 +0100

    loginManager: Handle unset XDG_SESSION_ID more gracefully
    
    While certain functionality won't be available when running outside a
    (logind) user session, that's still better than crashing ...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788046

 js/misc/loginManager.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index ed390f7..d2c7290 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -119,7 +119,13 @@ var LoginManagerSystemd = new Lang.Class({
             return;
         }
 
-        this._proxy.GetSessionRemote(GLib.getenv('XDG_SESSION_ID'), Lang.bind(this,
+        let sessionId = GLib.getenv('XDG_SESSION_ID');
+        if (!sessionId) {
+            log('Unset XDG_SESSION_ID, getCurrentSessionProxy() called outside a user session.');
+            return;
+        }
+
+        this._proxy.GetSessionRemote(sessionId, Lang.bind(this,
             function(result, error) {
                 if (error) {
                     logError(error, 'Could not get a proxy for the current session');


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