mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
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. (cherry picked from commit 7ebbe4a5ce431a2bf03066ec85513c693836550b)
This commit is contained in:
parent
786b7a7208
commit
5c94225d0c
@ -495,7 +495,7 @@ int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) {
|
||||
continue;
|
||||
}
|
||||
|
||||
battery_last_capacity = PTR_TO_CAPACITY(hashmap_get(last_capacity, battery_name));
|
||||
battery_last_capacity = get_capacity_by_name(last_capacity, battery_name);
|
||||
if (battery_last_capacity <= 0)
|
||||
continue;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user