[gnome-settings-daemon] power: Protect against a potential SIGFE
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Protect against a potential SIGFE
- Date: Fri, 16 Sep 2011 08:17:46 +0000 (UTC)
commit d06b9cae10d4a482f76b32394334ebec6073751f
Author: Richard Hughes <richard hughsie com>
Date: Fri Sep 16 09:15:35 2011 +0100
power: Protect against a potential SIGFE
This can only happen if all laptop batteries have zero energy_full.
Resolves https://bugzilla.gnome.org/show_bug.cgi?id=659205
plugins/power/gsd-power-manager.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 4c29099..c1008dc 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -818,7 +818,8 @@ engine_update_composite_device (GsdPowerManager *manager,
}
/* use percentage weighted for each battery capacity */
- percentage = 100.0 * energy_total / energy_full_total;
+ if (energy_full_total > 0.0)
+ percentage = 100.0 * energy_total / energy_full_total;
/* set composite state */
if (is_charging)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]