diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-10-10 12:24:51 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-10-10 12:24:51 -0500 |
commit | 62aff379372b43a6f2df4d12a581fc80e2af0f5d (patch) | |
tree | dc7d295a4d19e3f93d0427ce72ddf1b0d9967a11 /src | |
parent | bda9a644181c42de48783a6c764a69ba7645cfc3 (diff) | |
download | ayatana-indicator-session-62aff379372b43a6f2df4d12a581fc80e2af0f5d.tar.gz ayatana-indicator-session-62aff379372b43a6f2df4d12a581fc80e2af0f5d.tar.bz2 ayatana-indicator-session-62aff379372b43a6f2df4d12a581fc80e2af0f5d.zip |
test for uproxy!=NULL before using it
Diffstat (limited to 'src')
-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) |