[gnome-control-center] 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] power: Fix possible crash if up_client_get_devices() fails
- Date: Mon, 29 Jun 2015 15:50:28 +0000 (UTC)
commit d2c0b66275683169395616d19fce8d4dacfe84bf
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 f30b90e..500649a 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1136,7 +1136,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]