diff options
author | Julian Murgia <the.straton@gmail.com> | 2017-07-26 23:29:51 +0200 |
---|---|---|
committer | Julian Murgia <the.straton@gmail.com> | 2017-07-26 23:29:51 +0200 |
commit | 71dcb7fcc4b10e956668485b7ac1f9a5c1735dfb (patch) | |
tree | 7cc397f52496f6f145248f4ccb6bb01dc1bb793f /platform/x11/power_x11.cpp | |
parent | 5c3f05a68043bbc2b5dd7f101bdab0077c95a3c8 (diff) |
Fixes power management on x11 platform and removes explicit NULL pointer dereference.
Diffstat (limited to 'platform/x11/power_x11.cpp')
-rw-r--r-- | platform/x11/power_x11.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp index 093d24f406..8e69a2223f 100644 --- a/platform/x11/power_x11.cpp +++ b/platform/x11/power_x11.cpp @@ -171,25 +171,18 @@ void PowerX11::check_proc_acpi_battery(const char *node, bool *have_battery, boo charge = true; } } else if (String(key) == "remaining capacity") { - char *endptr = NULL; - //const int cvt = (int) strtol(val, &endptr, 10); String sval = val; const int cvt = sval.to_int(); - if (*endptr == ' ') { - remaining = cvt; - } + remaining = cvt; } } ptr = &info[0]; while (make_proc_acpi_key_val(&ptr, &key, &val)) { if (String(key) == "design capacity") { - char *endptr = NULL; String sval = val; const int cvt = sval.to_int(); - if (*endptr == ' ') { - maximum = cvt; - } + maximum = cvt; } } |