]> git.ipfire.org Git - thirdparty/systemd.git/commit
sleep: do not abort if we try to query capacity of missing battery
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 23 Jan 2023 14:43:35 +0000 (15:43 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 23 Jan 2023 21:05:36 +0000 (22:05 +0100)
commit7ebbe4a5ce431a2bf03066ec85513c693836550b
treec1c7a84060242d78789ea3f15c86525ea774352c
parente830d6dd2d76ecd3881e5c14bddc23f8cddfd137
sleep: do not abort if we try to query capacity of missing battery

Fixes #25584.

From the issue:
Assertion 'capacity >= 0' failed at src/shared/sleep-config.c:58, function PTR_TO_CAPACITY(). Aborting.

(gdb) bt

The problem is that PTR_TO_CAPACITY(hashmap_get(last_capacity, battery_name))
will abort if it's called with a name not present in the hashmap. We want to
skip the device silently in this case instead.
src/shared/sleep-config.c