diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-10-10 18:15:06 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2012-10-10 18:15:06 +0000 |
commit | 57b62d5fa18525811e1a4b413b1c6b966b5f28f8 (patch) | |
tree | dc7d295a4d19e3f93d0427ce72ddf1b0d9967a11 | |
parent | bda9a644181c42de48783a6c764a69ba7645cfc3 (diff) | |
parent | 62aff379372b43a6f2df4d12a581fc80e2af0f5d (diff) | |
download | ayatana-indicator-session-57b62d5fa18525811e1a4b413b1c6b966b5f28f8.tar.gz ayatana-indicator-session-57b62d5fa18525811e1a4b413b1c6b966b5f28f8.tar.bz2 ayatana-indicator-session-57b62d5fa18525811e1a4b413b1c6b966b5f28f8.zip |
Test upower_proxy for NULL before using it.. Fixes: https://bugs.launchpad.net/bugs/1061844. Approved by Ted Gould, jenkins.
-rw-r--r-- | src/session-menu-mgr.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index f5b5bcf..394110c 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -247,23 +247,27 @@ session_menu_mgr_class_init (SessionMenuMgrClass * klass) static void on_upower_properties_changed (SessionMenuMgr * mgr) { - gboolean b; gboolean need_refresh = FALSE; - /* suspend */ - b = dbus_upower_get_can_suspend (mgr->upower_proxy); - if (mgr->can_suspend != b) + if (mgr->upower_proxy != NULL) { - mgr->can_suspend = b; - need_refresh = TRUE; - } + gboolean b; - /* hibernate */ - b = dbus_upower_get_can_hibernate (mgr->upower_proxy); - if (mgr->can_hibernate != b) - { - mgr->can_hibernate = b; - need_refresh = TRUE; + /* suspend */ + b = dbus_upower_get_can_suspend (mgr->upower_proxy); + if (mgr->can_suspend != b) + { + mgr->can_suspend = b; + need_refresh = TRUE; + } + + /* hibernate */ + b = dbus_upower_get_can_hibernate (mgr->upower_proxy); + if (mgr->can_hibernate != b) + { + mgr->can_hibernate = b; + need_refresh = TRUE; + } } if (need_refresh) |