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.
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;