[gnome-control-center/gnome-3-16] power: Fix possible crash if up_client_get_devices() fails
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-16] power: Fix possible crash if up_client_get_devices() fails
- Date: Mon, 29 Jun 2015 15:51:51 +0000 (UTC)
commit f28ace2c392d115a5ab58b5b8badbb006e47be08
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jun 17 10:53:07 2015 +0200
power: Fix possible crash if up_client_get_devices() fails
up_client_get_devices() can fail if upower crashes or isn't available.
Make sure not to crash ourselves by handling NULL return values as we do
later in the loop.
See https://bugzilla.redhat.com/show_bug.cgi?id=1175421
https://bugzilla.gnome.org/show_bug.cgi?id=751095
panels/power/cc-power-panel.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index b4f017e..ac3f4b0 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1077,7 +1077,7 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
UpDeviceKind kind;
devices = up_client_get_devices (self->priv->up_client);
- g_debug ("got %d devices from upower\n", devices->len);
+ g_debug ("got %d devices from upower\n", devices ? devices->len : 0);
for (i = 0; devices != NULL && i < devices->len; i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]